[Tex/LaTex] Advancing \today by x days

advdatedatetime

New LaTex user here, hoping you can help me.

I am drafting a letter, the submission date of which I do not yet know. For this reason I am dating it using \today. However, in the text of the letter, I would like to specify a date two weeks in advance of \today. In other words, there is an [advance date] and an [advance date II], the latter specifying a date 14 days after the former.

I found the advdate package but, unless I am mistaken, it doesn't allow for setting two individual hypothetical dates. Is there a non-complicated way of implementing this?

Thanks for your help.

Best Answer

The package advdate provides the command \AdvanceDate[] with an optional argument, defaulting to 1 (day). However, it changes the date output by \today. This can be prevented by using a new command, say \advanceday and using a group inside, such that registers are changed only locally, this is shown in the output, where the second call to \today (after the first call to \advanceday still shows the current date (9th of July 2014), so it is not affected by \advanceday outside!

I used an optional argument to \advanceday, defaulting to 14 days and added a command \evenmoreadvanceday, with optional argument defaulting to 28 days, but actually, \evenmoreadvanceday is redundant, since \advancedays[28] does the same job. It is rather meant to make the second date more outstanding in the code.

You can change the output format of \today by usage of datetime package and its various options/commands (not done in here)

\documentclass{article}%

\usepackage{advdate}

\newcommand{\advanceday}[1][14]{%
\begingroup
\AdvanceDate[#1]%
\today%
\endgroup
}%

\newcommand{\evenmoreadvanceday}[1][28]{%
\advanceday[#1]%
}%


\begin{document}

Today is \today~and in 14 days it is \advanceday, but today is still \today~and in 28 days it is \evenmoreadvanceday%

\end{document}

enter image description here

Related Question