GeneralUppercase months in “datetime”

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

Uppercase months in “datetime”

Post by comandos »

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:

Code: Select all

\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:

Code: Select all

%%%%%%%%%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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply