1

When using the datetime package, I could define dates "globally" like this:

\newdate{sample}{03}{09}{2016}
\begin{document}
\displaydate{sample}
\end{document}

Can anyone tell me, how this is possible with datetime2 library because I just don't get it somehow...

Full document:

\documentclass[a4paper, 12pt, DIV=calc, headings=small]{scrreprt}
%Used packages
\usepackage[UKenglish]{babel}
\usepackage[utf8]{luainputenc}
\usepackage{datetime}

%Other definitions
\pagenumbering{arabic}

\newdate{sample}{31}{01}{2017}

\begin{document}
\displaydate{sample}
\end{document}
4
  • Did you read section 4 Storing and Using Dates and Times in the datetime2 documentation? Sep 4 '16 at 17:02
  • I must have just read over it... :( But still thanks for the info. Sep 4 '16 at 17:38
  • In this question (the link) I just wanted to asked how to reformat today's date... Here I wanted to know how to define dates in the datetime2 library. So I guess not. Sep 4 '16 at 18:10
  • 3
    I don't agree that the questions are duplicates. I've posted on meta Sep 6 '16 at 12:40
1

Solution is here:

\documentclass{article}

\usepackage[UKenglish]{babel}
\usepackage[useregional]{datetime2}

\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}}

\DTMsavedate{sample}{2017-01-31}

\begin{document}
\DTMusedate{sample}

\end{document}

Thanks to Nicola Talbot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.