LaTeX forum ⇒ GeneralUppercase months in “datetime”

LaTeX specific issues not fitting into one of the other forums of this category.
comandos
Posts: 15
Joined: Sat Dec 15, 2018 3:46 pm

Uppercase months in “datetime”

Postby comandos » Mon Aug 19, 2019 1:45 pm

Greetings,
I’m trying to type out the current month + year both in uppercase.
My current solution works like this:
1) Using “datetime” I call for the current month+year then
2) To make them uppercase I use “a custom” macro that replaces “month name” with my uppercase version

Here is a basic example of calling month and year together:
\documentclass[a4paper,12pt]{article}
\usepackage[slovene]{babel}
\usepackage[utf8]{inputenc}

\usepackage{datetime}
\newdateformat{monthyeardate}{%
	\monthname[\THEMONTH] \THEYEAR}

\begin{document}

\MakeUppercase{\monthyeardate\today}  %not working :/
\monthyeardate\today

\end{document}

And here is the custom macro I use:
%%%%%%%%%month’s uppercase  %%%%%%%%%
	
	\makeatletter
	\renewcommand*{\monthnameslovene}[1][\month]{%
		\@orgargctr=#1\relax
		\ifcase\@orgargctr
		\PackageError{datetime}%
		{Invalid Month number \the\@orgargctr}%
		{Month numbers should go from 1 (JANUAR) to 12 (DECEMBER)}%
		\or JANUAR \or FEBRUAR \or MAREC \or APRIL \or MAJ \or JUNIJ \or JULIJ %
		\or AVGUST \or SEPTEMBER \or OKTOBER \or NOVEMBER \or DECEMBER %
		\else
		\PackageError{datetime}%
		{Invalid Month number \the\@orgargctr}%
		{Month numbers should go from 1 (JANUAR) to 12 (DECEMBER)}%
		\fi
	}%
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Together they work but is there a better way/correct way of achieving the desired effect?
Best regards

Return to “General”

Who is online

Users browsing this forum: No registered users and 11 guests