9

In my generated letter I use \formatdate{\MDay}{\MMonth}{\MYear}. In header I specific \usepackage[nodayofweek,level]{datetime}.

I have got then date like 10th May, 2012, but I would like only 10th May 2012. The same problem is in the address block, where is actual date generate automatically.

How can I check this?

  • Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This will also serve as a test case and ensure that the solution actually works for you. – Peter Grill May 10 '12 at 17:43
10

The comma as a separator is actually hardcoded into the various definitions of \formatdate, but you may use the etoolbox package to remove it.

\documentclass{article}

\usepackage[nodayofweek,level]{datetime}

\usepackage{etoolbox}
\patchcmd{\formatdate}{,}{}{}{}

\begin{document}

\today

\end{document}

enter image description here

6

You can use the following definition \ddmmmyyyydate to achieve (and reformat) what you're after:

enter image description here

\documentclass{article}
\usepackage[nodayofweek,level]{datetime}% http://ctan.org/pkg/datetime
\makeatletter
\DeclareRobustCommand*{\ddmmmyyyydate}{%
  \renewcommand*{\formatdate}[3]{%
    \ifshowdow\shortdayofweekname{##1}{##2}{##3} \fi
    \@day=##1\relax\@month=##2\relax\@year=##3\relax
    \ordinaldate{\the\@day}\ \shortmonthname[\@month] \the\@year}
}
\makeatother
\begin{document}
\today

\ddmmmyyyydate

\today
\end{document}

The english option to isodate prints this output by default. Alternatively, use \isospacebeforeyear can be used to modify the separator between month and year:

enter image description here

\documentclass{article}
\usepackage[english]{isodate}% http://ctan.org/pkg/isodate
\begin{document}
\today

\isospacebeforeyear{, }

\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.