# Ordinal date in section

\monthname[10] \ordinaldate{10}


produces October 10th, as expected. But once I put it into a section, I get this error:

! Argument of \@ordinalnum has an extra }.
<inserted text>
\par
l.11 \section*{\monthname[10] \ordinaldate{10}}


What is happening and why?

EDIT

Though

\section*{\monthname[10] \protect\ordinaldate{10}}


works just fine for displaying the date like I want to, I suddenly get a new error from the main file that I am including this 2006-10.tex file from:

! Extra \else.
\@include ...ediate \closeout \@partaux \fi \else
l.89 \include{Years/2006-10}


I am not using \if or \else statements anywhere in either the main document, or this included document. The error goes away if I remove \protect\ordinaldate{10}.

Weirdly enough, adding other things like \protect\dayofweekname{10}{10}{2006} doesn't produce such an error. Only putting in \protect\ordinaldate{10} causes the include error.

EDIT 2

\protect\ordinalnum{10} doesn't cause such an error, despite \protect\ordinaldate{10} doing so, so I guess I will just use \ordinalnum for now

-

You need to \protect \ordinaldate:

\documentclass{article}
\usepackage{datetime}
\begin{document}

\section{\monthname[10] \protect\ordinaldate{10}}

\end{document}


-
It worked! Thank you, and I wonder if you could take a stab at the new problem I'm having now? –  wrongusername Sep 10 '13 at 5:23
@wrongusername you need to \protect it only in sectional units (such as in \section, \chapter...) and maybe also in \caption. No need to \protect it in other contexts. –  Gonzalo Medina Sep 10 '13 at 5:32