Sign up ×
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 there a package that allows one to work with dates in the following way: just as \date shows today's date, I would like to have a command that dates the document 7 days from today.

Also, since I would like to use this as a template, I do not want to manually enter the dates myself. Is this possible?

share|improve this question
Have you tried the datenumber package? – Bruno Le Floch Feb 5 '11 at 20:57
Thanks. I tried it and it works very well! – user1227 Feb 6 '11 at 18:45

3 Answers 3

up vote 27 down vote accepted

See the datenumber and advdate packages (and the datetime package for formatting options).

Edit: Added small example, essentially stolen from the datenumber documentation.





Today is \today, 7 days from now it's \datedate.

share|improve this answer
It would be very helpful if you include an example (for 7 days from today, as in the question). – Hendrik Vogt Feb 5 '11 at 21:37
  \ifcase#1 31\or28\or31\or30\or31\or30
  \advance\day by #1
    \day=\numexpr \the\day-\DiM\relax 


\today -- \Today[30]


the year can also be tested if the month is 13 after increasing

share|improve this answer
NOTE: this solution has not considered a leap day (February 29). :-) – xport Aug 2 '11 at 14:51

It is perhaps worth showing an example using the advdate package, mentioned by Villemoes, as it has a single command solution for this, \DayAfter[n], which prints the date n days ahead and leaves \today unchanged on exit. So for 7 days ahead:





     August 2, 2011
  August 9, 2011
  August 2, 2011

the advdate package also provides separate macros \AdvanceDate to change the value of \today to a number of days ahead together with \SaveDate and \SetDate to save and set the current value used for \today. texdoc advdate gives full details for these and other macros in the package, as usual.

share|improve this answer
Welcome to! A tip: you can use backticks ` to mark your inline code as I did in my edit. – doncherry Aug 2 '11 at 14:43
@don -- Thanks for the helpful comment. I have found and read the meta FAQs for this, e.g., and the markdown help files so will be better placed if ever I have another piece of code to share :-) – mas Aug 3 '11 at 11:15

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.