1

I'm able to change today's date to different format: month YEAR, normal and digits. Now I also need to add a future date: 28 days from today. How can I do that?

\documentclass[a4paper,12p]{article}

\usepackage{datetime}
\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH] \THEYEAR}

\newdateformat{normal}{%
  \longdate \ordinaldate{\THEDAY} \monthname[\THEMONTH] \THEYEAR}

\newcommand\twodigits[1] {\ifnum#1<10 0#1\else #1\fi}
\newdateformat{quoteNo}{%
   \THEYEAR--\twodigits{\THEMONTH}--\THEDAY }

\begin{document}

 \normal \today \\

Quote No: \quoteNo \today --1 \\

Expiry: %28 days from now

\end{document}

Other dates work

Chris Peh
  • 310

1 Answers1

2

Use advdate. Also see: https://tex.stackexchange.com/a/188739/193767

\documentclass[a4paper,12p]{article}

\usepackage{datetime}
\newdateformat{monthyeardate}{%
    \monthname[\THEMONTH] \THEYEAR}

\newdateformat{normal}{%
    \longdate \ordinaldate{\THEDAY} \monthname[\THEMONTH] \THEYEAR}

\newcommand\twodigits[1] {\ifnum#1<10 0#1\else #1\fi}
\newdateformat{quoteNo}{%
    \THEYEAR--\twodigits{\THEMONTH}--\THEDAY }

\usepackage{advdate}

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

\begin{document}

    \normal \today \\

    Quote No: \quoteNo \today --1 \\

    Expiry: \advanceday[28] %28 days from now

\end{document}