[Tex/LaTex] Query regarding usage of \date

datetime

Hi I am using Texmaker to create some documents. When I use \date{text} the text being any date, and then run the .tex file I don't see the date in the PDF file. It's just blank. Not sure why. Is there a specific package to use \date?

Best Answer

\date merely sets the date and doesn't print it, just like \title and \author also doesn't typeset anything. Actually, \date stores its value in \@date, which you can retrieve if you don't use \maketitle (since it acts in a self-destruct fashion, wiping out most of the title-related information after its usage). If you which to print it, you could define

\makeatletter
\newcommand{\printdate}{\@date}
\makeatother

in your preamble and use \printdate wherever you want to show the date specified through \date.

However, the best way to access the date and print it in various formats, is to use the isodate package. See Date format in LaTeX.

Related Question