TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Currently I put the date in my document using: \date{\today}

How do I display the date in the YYYY-MM-DD format?

share|improve this question
See here ctan.org/pkg/datetime From the documentation (pg 10) we have The option yyyymmdd makes \today produce YYYY/MM/DD date – Sigur Jan 4 '14 at 13:30
up vote 48 down vote accepted

edit: As noted by @Sean Allred, datetime has been superseded by datetime2.

Using the package datetime with the option yyyymmdd as


you just change the value of \dateseparator to replace the default / by - (or -- if you want).


Also as noted by @Vincent, you can define your own date format.

enter image description here

share|improve this answer
Somebody should check whether ISO 8601 says that the separator has to be - or --. (iso.org/iso/home/standards/iso8601.htm). Definitely YYYY/MM/DD should not be used - that would violate the standard. Keith – KeithB Jan 8 '14 at 9:53
@KeithB, Wikipedia claims, “The separator used between date values (year, month, week, and day) is the hyphen”. Also, it’s unlikely the standard mandates characters encoded neither in EBCDIC nor ASCII. – J. C. Salomon Jan 13 '14 at 19:20
note: datetime has been superseded by datetime2 – Sean Allred Apr 6 '15 at 17:38
Sigur is correct. However, note that the datetime package must come after the babel package. Babel seems to change the format as well. – qznc Sep 2 '15 at 12:34

According to the link of Sigur:

share|improve this answer

My solution needs no packages. The only thing you need to know is that the primitive registers \day, \month and \year include the desired information:

\def\twodigits#1{\ifnum#1<10 0\fi\the#1}

The date in my format: \mydate.
share|improve this answer

Use the package isodate


It offers various options (and needs one of its language options) and commands to change the date format.

share|improve this answer

Use the package datetime2


share|improve this answer
This should be an edit to the other answers using datetime since datetime is now superseded and should no longer be used for new documents. – Paul Gessler Apr 6 '15 at 17:55

Your Answer


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.