[Tex/LaTex] Datetime capitalize month

capitalizationdatetimelanguages

I'm using the datetime package. How could I have a date format with the month name in capital letters?

\usepackage{datetime}
% some code here
\newdateformat{mifecha}{Bilbao, a \THEDAY~de \monthname[\THEMONTH] de \THEYEAR}
\mifecha\date{\today}

Gives me:

Bilbao, a 15 de noviembre de 2013

But I would like:

Bilbao, a 15 de Noviembre de 2013

I have tried the command \capitalisewords without success, but maybe it's because I should use a combination of \expandafter commands or something related.

Best Answer

If you're loading babel with the spanish option, then your months will start in lowercase as this is the definition enforced by babel. A redefinition of \monthnamespanish corrects this:

enter image description here

\documentclass{article}
\usepackage[spanish]{babel}% http://ctan.org/pkg/babel
\usepackage{datetime}% http://ctan.org/pkg/datetime
\newdateformat{mifecha}{Bilbao, a \THEDAY~de \monthname[\THEMONTH] de \THEYEAR}
\makeatletter
\renewcommand{\monthnamespanish}[1][\month]{%
  \@orgargctr=#1\relax
  \ifcase\@orgargctr
    \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
      Month numbers should go from 1 to 12}%
    \or Enero%
    \or Febrero%
    \or Marzo%
    \or Abril%
    \or Mayo%
    \or Junio%
    \or Julio%
    \or Agosto%
    \or Septiembre%
    \or Octubre%
    \or Noviembre%
    \or Diciembre%
    \else \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
      Month numbers should go from 1 to 12}%
  \fi}
\makeatother
\begin{document}
\mifecha\today
\end{document}

You may also be interested in updating \dayofweeknameidspanish and \shortdayofweeknameidspanish.

Related Question