TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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