short date in bash PS1 prompt

fergusdawson picture fergusdawson · Feb 8, 2012 · Viewed 17.5k times · Source

You can use \d in the your PS1 confuration to display a long date ie. Tues 18 May, but how can I get it to display it in a format like 18.05.2012 for example?

Answer

FatalError picture FatalError · Feb 8, 2012

Try including \D{%d.%m.%Y}. You can use any time format suppoorted by strftime(3).