2

What I'm getting now from \today is:

14th September 2018

How do I change it to:

14-Sep-2018

2 Answers2

8

I think that the easiest way is to redefine \today to print this:

\documentclass{article}
\renewcommand\today{\number\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}%

\begin{document}

  \today

\end{document}

For completeness, here is the output:

enter image description here

4

Here's how to do it with datetime2 and datetime2-english:

\documentclass{article}

\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{daymonthsep={-},monthyearsep={-},ord=omit,abbr}

\begin{document}
\today
\end{document}

This produces:

15-Sep-2018

You can replace en-GB with any of the other English localisation styles that uses a day month year format. For example:

\documentclass{article}

\usepackage[en-MT]{datetime2}
\DTMlangsetup[en-MT]{daymonthsep={-},monthyearsep={-},ord=omit,abbr}

\begin{document}
\today
\end{document}
Nicola Talbot
  • 41,153