1

I'd like to increment the date in the format

[Day of week] [Day] [Month] [Year]

by one each step, but I can't get the day of the week to increment. I've been looking at this answer but I can't get dow to advance properly.

\documentclass{article}


\usepackage[british]{babel}
\usepackage[useregional,showdow]{datetime2}


\usepackage{advdate}

\usepackage{etoolbox}

\makeatletter
\appto\FixDate{%
  \edef\@dtm@currentyear{\the\year}%
  \edef\@dtm@currentmonth{\the\month}%
  \edef\@dtm@currentday{\the\day}%
%  \edef\@dtm@currentdow{\the\dow}%??
}
\makeatother

\begin{document}

\today 

\AdvanceDate[1] 

\today

\AdvanceDate[1] 

\today

\AdvanceDate[1] 

\today

\AdvanceDate[1] 

\today

\end{document}

1 Answer 1

1

Here's an alternative approach using only datetime2:

enter image description here

\documentclass{article}

\usepackage[british]{babel}
\usepackage[useregional,showdow]{datetime2}

\NewDocumentCommand{\TODAY}{}{%
  \DTMifsaveddate{now}{}{\DTMsavenow{now}}% If "now" date doesn't exist, set it
  \DTMusedate{now}% Print date
}

% Partly taken from https://tex.stackexchange.com/a/318012/5764
\newcount\daycount
\NewDocumentCommand{\AdvanceTODAY}{ O{1} }{%
  \DTMsaveddateoffsettojulianday{now}{#1}\daycount% Identify Julian days
  \DTMsavejulianday{now}{\number\daycount}% Set new date
}

\begin{document}

\TODAY

\AdvanceTODAY% Defaults to advance 1 day

\TODAY

\AdvanceTODAY[1] 

\TODAY

\AdvanceTODAY[2] 

\TODAY

\end{document}
1
  • Excellent thanks so much!
    – alice19
    Commented Jul 14, 2023 at 8:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .