我想以以下格式增加日期
[星期几] [日] [月] [年]
每一步增加一个,但我无法让星期几增加。我一直在寻找这个答案但我无法让 dow 正常前进。
\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
这是仅使用datetime2
:
\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}