Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

2 Answers 2

up vote 9 down vote accepted

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

share|improve this answer
    
Thanks so much :-). –  Pavla May 10 '12 at 17:56
    
@Pavla Thanks for accepting my answer, but please also upvote it -- this has to be done separately from accepting. –  lockstep May 10 '12 at 17:58

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}
share|improve this answer
    
Thank you for your help. –  Pavla May 10 '12 at 17:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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