As datetime is superseded by datetime2, I'm struggling hard to achieve the following using the new package:

In an English document, I would like to show the current date (\today) once like this 20th December 2017 and once like this 2017-12-20.

According to the documentation, I get it right only one way globally for the whole document. I didn't find a simple example showing me how to get this done.

The answer given at https://tex.stackexchange.com/a/250057 fiddles with \@dtm@month etc. Is it that hard? It should be simple 🙄

  • 1
    Please provide a minimal working example i.e. code for a small document showing what you've got and what you've tried.
    – cfr
    Dec 20, 2017 at 17:23
  • There should be absolutely no reason to fiddle with \@dtm@month in datetime2. The second method in the answer you linked to fits the design of datetime2. The first method may just as well use \month and \the\year. Dec 20, 2017 at 17:52

2 Answers 2


You don't need to define a new format. You can use one of the regional English day-month formats, such as en-GB, for the textual date and iso for the numeric ISO-style date:




\today. \DTMsetstyle{iso}\today.


Requires that both datetime2 and datetime2-english are installed.

20th December 2017. 2017-12-20.


In sake of coming up with a short example, I solved it myself:



\renewcommand{\DTMdisplaydate}[4]{\DTMenglishordinal{##3}\ \DTMenglishmonthname{##2}\ \number##1}%


Though it is not as short as Nicola Talbot's answer 😕

  • This is a good example of where working on a minimal example actually helped you solve your own problem!
    – Werner
    Dec 20, 2017 at 18:12
  • @Werner I know of the benefits of a minimal example. I have to admit that the datetime2 documentation is not good as a quick reference: it's hard to quickly distinguish between explanatory text, sample source code and the resulting example. Dec 20, 2017 at 18:23

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.