# How to define and use the date format “1 Jan 2012 7.03am”

How can I define and use the date format "1 Jan 2012 7.03am"?

-

I'm answering my own question here, in the hope that other people might find this information useful. The answer is to use

\usepackage{datetime}
\settimeformat{ampmtime}
\newdateformat{mydate}{\THEDAY{ }\shortmonthname{ }\THEYEAR{ }\currenttime}


and then

\mydate\today


where you want to insert the date and time.

-
It would be better if you expanded the answer to cover also other date formats (for example in different languages). –  egreg Jan 21 '12 at 9:44
Unfortunately a bug in ampmtime makes 12.22pm come up as "12.22 noon"! –  Harry Macpherson Jan 21 '12 at 12:26