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.

  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jul 9 '14 at 15:45
  • @percusse: The question you linked is about a \tomorrow command, but this post is about a \fortnight or a double \fortnight` command ;-). It is related, for sure, but not a duplicate. – user31729 Jul 11 '14 at 8:25
  • @ChristianHupfer You can add or subtract as many as you want instead of +1. It's just the name of the macro it is not limited to tomorrow per se – percusse Jul 11 '14 at 9:27

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)






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


enter image description here

|improve this answer|||||
  • Thank you very much @Christian Hupfer! I'm not sure how or why, but it works! – foucalt Jul 9 '14 at 16:15
  • 3
    @foucalt: If you have questions about the code, just ask ;-) – user31729 Jul 9 '14 at 16:35

A variation of advdate:

\usepackage{xstring}% Needed for \IfStrEqCase
\usepackage{datenumber}% Date formatting
\usepackage{advdate}% Needed for \AdvanceDate
\usepackage{pgf}% For math

\pgfmathsetcounter{dateOffset}{7-int(\the\value{datedayname})}% Initialize
    }[\PackageError{\SetDateOffsetForNext}{Do not know "#1" as day of week}{}]%

    \SetDateOffsetForNext{#1}% Determine date offset
    \AdvanceDate[\value{dateOffset}]% Advance to specified day
    \today% Print specified date
    \AdvanceDate[-\value{dateOffset}]% Restore current day
    is #1day 2 weeks later% debug output

Today is \today\par

enter image description here

|improve this answer|||||
  • 1
    This is interesting, but if I understood correctly your code, you can only compute what date is next Monday, right? – Clément Jul 9 '14 at 17:00
  • After 2 weeks (14 days) – subham soni Jul 9 '14 at 17:01
  • I appreciate other solutions too, but I do not understand why you restricted your solution to Mondays? (Using \PrintDateForNext{tue} fails with compilation error, for example) The specific day of week is basically completely irrelevant. Only the relative day shift of 14 (or whatever) days is of importance. – user31729 Jul 9 '14 at 17:49
  • 1
    @subhamsoni: It is customary to provide a link to where you got the original code from: Insert relative date and time specifications?. – Peter Grill Jan 9 '15 at 6:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.