# How do I get \today to display today's date as 14-Sep-2018?

What I'm getting now from \today is:

14th September 2018

How do I change it to:

14-Sep-2018

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:

• +1 but what's wrong with \usepackage[yyyymmdd]{datetime} ? – user121799 Sep 15 '18 at 2:27
• +1 because you didn't use an external package. :) – manooooh Sep 15 '18 at 2:41
• @marmot I guess it’s all a question of what you know:) – Andrew Sep 15 '18 at 11:25

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:

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}