Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to make LaTeX believe that the current year is 2012, so that \the\year prints 2012?

  % What to do so that the following prints 2012?

I haven't found advice in The \the command; trying to set \year using \setcounter{year}{2012} didn't work either.

share|improve this question
It's an internal variable, not a LaTeX counter: \year=2012 –  egreg Jun 16 '14 at 21:54
@egreg: Thanks for enlightening me, works like a charm but has to come after \begin{document} (not a problem for me). Care to write this as an answer? How does this fit the accepted answer of the linked question? –  krlmlr Jun 16 '14 at 22:02
I have supplemented my answer there with these parameters. –  egreg Jun 16 '14 at 22:09

3 Answers 3

up vote 17 down vote accepted

TeX initializes \day,\month, \year and \time at the beginning of a job; they are internal integer registers that can be assigned new values. However, there is no LaTeX interface for modifying their values, so the primitive TeX assignment style has to be used: thus


will do, and similarly for the other registers mentioned above. Leave a space (or end of line) after the value, or append \relax to be sure.

Note that \time is initialized with the number of minutes past midnight when the job started. The initial values of \day, \month and \year are the expected ones.

You can print their values by prefixing the register's name with \the, as described in The \the command.

share|improve this answer

Just for fun, without a TeX primitive:

\ThisYear{1492}      Christopher Columbus discovers America in \the\year. \par
\AdvYear{509}        {\em\the\year: A Space Odyssey} was a film made in% 
\AdvYear{-33}        \the\year. \par 
\SetDate[20/07/1969] Man takes first steps on the Moon in \today. \par
\AdvanceDate[16403]  But today is \today.
share|improve this answer
Interesting. So, the advdate package interacts with the TeX variables? –  krlmlr Jun 17 '14 at 7:04
@krlmlr Yes. Commands as \ThisYear are fairly simple (only do \year#1 \relax) but the package is justified because add x days to \today and obtain the right date is not so easy. –  Fran Jun 17 '14 at 15:23

Just for fun, a quick LaTeX interface to the year:






share|improve this answer

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.