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

datetimeformatting

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

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

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

Using the package datetime with the option yyyymmdd as

\usepackage[yyyymmdd]{datetime}


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

\renewcommand{\dateseparator}{--}


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