[Tex/LaTex] Date format: YYYY-MM-DD


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

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

Best Answer

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