10.2. Date and Time

If you don't like the built-ins for date and time, recent versions of Bash (3.1.17 and up has it, possibly earlier) include the \D{...} escape sequence which allows you to choose your own. The material inside the braces has to be in the same format as the date, so \D{%l:%M%P} gives " 6:50pm", \D{%Y%m%d.%H%M} gives "20071016.1850" and \D{%A, %d %B %Y} gives "Tuesday, 16 October 2007". Use man date to figure out these wonderfully non-intuitive strings of inline garbage.