0

I created a custom format and saved a date like this:

\usepackage[ngerman]{datetime2}
\DTMnewdatestyle{dateMonat}{\THEDAY. \monthnamengerman[\THEMONTH]}
\DTMsavedate{dateABC}{2023-07-20}

I want to display my date with my custom format. This would have been done like this in datetime

\dateMonat\today

Nothing similar works in datetime2. I suspect i will have to use \DTMuseDate to use dateABC

Setting the formatting before a section \DTMsetdatestyle{dateMonat} is not an option i like since the format often changes even in the same line.

Is there a better way? Or do i have to \DTMsetdatestyle{dateMonat} before every displayed date?

1 Answer 1

0

I found the problems i had:

  1. My style of formatting dates was very wrong. The new style for datetime2 is as follows
\DTMnewdatestyle{dateMonat}{%
\renewcommand{\DTMdisplaydate}[4]{\number##3. \DTMgermanmonthname{\number##2}}%
\renewcommand{\DTMDisplaydate}{\DTMdisplaydate}%
}
  1. The way i did not like is still the correct way:
\DTMsetdatestyle{dateMonat}\DTMusedate{dateABC}

One would still have to redo this for every date

You must log in to answer this question.

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