34

I have this code:

\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage[ddmmyyyy]{datetime}
\renewcommand{\dateseparator}{.}
\begin{document}
\today
\end{document}

Prints:

enter image description here

How can I make it print this:

07 May, 2013

0

2 Answers 2

31

From the datetime manual, you have two solutions:

  • either use the predefined shortdate format, which will print "07th may, 2013";
  • or define a new date format to get rid of the ordinal as well.

\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage[nodayofweek]{datetime}

\newdateformat{mydate}{\twodigit{\THEDAY}{ }\shortmonthname[\THEMONTH], \THEYEAR}

\begin{document}

\shortdate
\today

\mydate
\today
\end{document}

enter image description here

4
  • Sorry, I skipped the problem with the ordinal, working on it now.
    – T. Verron
    May 7, 2013 at 9:03
  • 1
    Is it possible to customize \today format yourself?
    – user4035
    May 7, 2013 at 9:11
  • See my edit for both answers. :)
    – T. Verron
    May 7, 2013 at 9:13
  • this is the reason why latex is truly an abomination :) terrible!
    – Fábio
    Aug 21, 2019 at 20:16
19

Here is an humble attempt without having to use any package:

\documentclass{article}
\renewcommand{\today}{\ifnum\number\day<10 0\fi \number\day \space%
\ifcase \month \or January\or February\or March\or April\or May%
\or June\or July\or August\or September\or October\or November\or December\fi,%
\number \year} 
\begin{document}
\today
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.