5

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

5

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
  • 2
    Unfortunately a bug in ampmtime makes 12.22pm come up as "12.22 noon"! – Harry Macpherson Jan 21 '12 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.