[Tex/LaTex] How to format \today to DD-MMM-YYYY format

datetime

Anyone know how to format \today to DD-MMM-YYYY format? (Example 01-JAN-2017).
Note that it is important that the month is in capital letters.

I've tried some available packages, but so far haven't been able to find a solution that works.

Anyone?

Best Answer

The below example fulfill your requirement:

\documentclass{article} 

\makeatletter
\def\today{%
  \two@digits{\the\day}-%
  \ifcase\month\or%
  JAN\or FEB\or MAR\or APR\or MAY\or JUN\or%
  JUL\or AUG\or SEP\or OCT\or NOV\or DEC\fi-%
  \number\year%
}
\makeatother

\begin{document}

\today

\end{document}

Hope this helps.

Output:

12-JUL-2017