[Tex/LaTex] Change month names in \today command

datetimedatetime2

The \today command will print the Latin name of the month with the nynorsk language option. I would like to change this by using the more traditional (and still very commonly used in speech) system of using the ordinal number "first", "second", etc. (abbreviated from "first month", "second month", etc.).

All it requires is to substitute the month names by i X, where i is the preposition "in" and X the ordinal, as seen in the table below. What's the most convenient way of doing that? With the datetime2 package?

\documentclass{article}
\usepackage[nynorsk]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\today\\

\begin{tabular}{*5{l}}
januar & i fyrste & & juli & i sjuande\\
februar & i andre & & august & i åttande\\
mars & i tredje & & september & i niande\\
april & i fjerde & & oktober & i tiande\\
mai & i femte & & november & i ellevte\\
juni & i sjette & & desember & i tolvte\\
\end{tabular}
\end{document}

enter image description here

For those who wonder – ordinals in Norwegian are definite, so there's no need for a definite article or determiner of any kind, as in English "in the first (month)", "in the second (month)", etc.

Best Answer

\documentclass{article}
\usepackage[nynorsk]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\renewcommand\datenynorsk{%
 \def\today{\number\day.~\ifcase\month\or
    i fyrste\or i andre\or i tredje\or i fjerde\or i femte\or i sjette\or
    i sjuande\or i åttande\or i niande\or i tiande\or i ellevte\or
    i tolvte\fi
    \space\number\year}}

\begin{document}
\today


\end{document}

enter image description here

Related Question