# Titling package and date formatting

I am using the titling package the resuse the defined date etc. using a plain \thedate command. However the date format is not what I need because of different type of localization.

My first shot was using isodate package using an appropriate option but this seems not to work with the titling package.

Anyway, here is what I created:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage[ngerman]{isodate}
\usepackage{titling}

\setlength{\parindent}{0pt}

\date{\today}

\begin{document}
typically this: \thedate \\
should be: \today \\
but it is: {\origdate\thedate} \\
not even: {\isodate\thedate} \\
\end{document}


Clearification: My intention is to reuse the defined date using \date with any apropriate tool. I came up using titling which works great for titles etc. but the date show formatting issues (\today and \thedate differ). Following a comment I tried to use the datetime2 package, which does not seem to work using the date reference solution I use so far.

Here is a snippet using datetime2 package:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage[useregional]{datetime2}
\usepackage{titling}

\setlength{\parindent}{0pt}

\date{\today}
%\DTMsavedate{date0}{\thedate} % does not compile
\DTMsavedate{date1}{2017-04-25}

\begin{document}
\selectlanguage{ngerman}
%maybe this: \DTMdate{\thedate} \\ % neither does this
wait, what: \DTMusedate{date1} \\
\end{document}

• Perhaps the package datetime2 is a better option: see for example: tex.stackexchange.com/a/290204/112503 – lAtExFaN Apr 25 '17 at 10:43
• @IAtExFan My intenion was to reuse the defined date with \date and apply an appropriate format which does not work using the datetime2 package. I tried using \DTMdate{\thedate} and \DTMsavedate{date}{\thedate} but neither did work with the date reference. I might come up storing the date by hand as an solution though. – maxik Apr 25 '17 at 11:14
• @maxit could you please give us an example input and the desired output? german date: \DTMusedate{date1}\\ \selectlanguage{british} british date: \DTMusedate{date1}\\ \selectlanguage{french} french date: \DTMusedate{date1} (seems ok for me, using: \usepackage[ngerman,british,french]{babel} of course) – lAtExFaN Apr 25 '17 at 11:28
• @IAtExFaN The desired output has to have the same format as the \today command (for simplicity). I had it working too, please see the question edit for further information. – maxik Apr 25 '17 at 11:35
• does this answer help? tex.stackexchange.com/a/57613/112503 – lAtExFaN Apr 25 '17 at 11:55

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage[ngerman]{isodate}
\usepackage{titling}

\setlength{\parindent}{0pt}

\date{\today}

\newcommand\convertdate[1]{\expandafter\convertdateaux#1\relax}
\def\convertdateaux#1 #2, #3\relax{#2.\@ #1 #3}

\begin{document}
typically this: \thedate \\
should be: \today \\
but it is: {\origdate\thedate} \\
not even: {\isodate\thedate} \\