# Set date counter using advdate package

I searched on mathematical operations, and found several interesing results, such as sequence, calculations, and future, among many others.

I am interested in an answer similar to this one, but instead of using \today, I would like to set a different date.

The aim is to create a schedule with initial date, say 01/03/2019 (dd/mm/yyy), and use a command or macro, say \nextlec to automatically return the date 7 days ahead (27/03/2019, and so on).

I tried many approach, but didn't get desired result. Could any one give me a MWE, please? Thank you!

My code follows below. Observe that the compilation returns dates alternatedly added 7 and 8 days.

\documentclass{article}

%-> Command to set following lectures
\newcounter{lecnum}
\setcounter{lecnum}{-1}

%... Set the first lecture date
\ThisYear{2019}
\ThisMonth{3}
\ThisDay{1}

\newif\iffirst
\newcommand{\nextlec}{%
\iffirst
\else
\global\firsttrue
\fi
\section*{\today}
\vspace{-5mm}
}

\begin{document}
\nextlec

\nextlec

\nextlec

\nextlec

\nextlec

\end{document}

• Please show us which code you have tried so far ... – Mensch Nov 20 '18 at 22:30
• The answer at the linked question sets the date to March 30, 2015, so not sure exactly what you want. FYI, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This will also serve as a test case and ensure that the solution actually works for you. That way those trying to help can focus on the solution as opposed to setting up a test case to figure out what you actually want. – Peter Grill Nov 20 '18 at 22:45
• Yes, guys... I am edditing the question with my code. – Brasil Nov 21 '18 at 0:15

Using some of your code, the following just sets \firstfalse with the first call to \nextlec, otherwise it advances the date. In both instances, it just sets \today as a \section.

\documentclass{article}

%... Set the first lecture date
\ThisYear{2019}
\ThisMonth{3}
\ThisDay{1}

\newif\iffirst
\firsttrue
\newcommand{\nextlec}{%
\iffirst
\firstfalse
\else
\fi
\section*{\today}
}

\begin{document}

\nextlec

\nextlec

\nextlec

\nextlec

\nextlec

\end{document}