# Change date format

How can I display certain dates as 2000/12 instead of 30. Dezember 2000

\documentclass{article}

\usepackage{datetime2}

\begin{document}

\DTMdate{2000-12-30} %Prints as expected: 30. Dezember 2000

\DTMdate{2000-12-30} %Should be printed as: 2000/12

\end{document}

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Mar 22, 2018 at 8:59
• As far as I can see, \date does not have an optional argument, neither by standard LaTeX nor by the datetime additions.
– user31729
Mar 22, 2018 at 10:24
• Note also that \date on its own doesn't actually typeset anything. It only sets what should be displayed by \maketitle. Mar 22, 2018 at 13:30
• Related (if not duplicate): Query regarding usage of \date Mar 22, 2018 at 14:11

You may need to define a new style, and then change style in the document. Either change it within a group or environment to keep the style change local, or change back to default afterwards.

\documentclass{article}

\usepackage{datetime2}

\DTMnewdatestyle{yyyymm}{%
\renewcommand\DTMdisplaydate[4]{##1/\DTMtwodigits{##2}}%
\renewcommand\DTMDisplaydate[4]{##1/\DTMtwodigits{##2}}%
}

\begin{document}

\DTMdate{2000-12-30} %Should be printed as: 2000/12

{% pair of braces makes the new style local
\DTMsetdatestyle{yyyymm}
\DTMdate{2000-12-30}
}

\DTMdate{2000-12-30}

\DTMsetdatestyle{yyyymm}
\DTMdate{2000-12-30}

% or you can set the style back to default
\DTMsetdatestyle{default}
\DTMdate{2000-12-30}

\end{document}