I try to extract the year, month and day from a string and write different text depending on the given date. I thought I could use xstring and etoolbox, but I can'st get it to work. Here's the code snippet:
\usepackage{xstring}
\usepackage{etoolbox}
\begin{document}
\newcommand{\Datum}{04.12.2011}
\newcommand{\Jahr}{\StrBehind[2]{\Datum}{.}}
\newcommand{\Monat}{\StrBetween[1,2]{\Datum}{.}{.}}
\newcommand{\Tag}{\StrBefore[1]{\Datum}{.}}
Jahr: \Jahr
\ifnumcomp{\Jahr}{=}{2011}{Jahr eq 2011}{Jahr neq 2011}
Which gives the following error:
pdflatex> ! Missing number, treated as zero.
pdflatex> <to be read again>
pdflatex> \let
pdflatex> l.11 {305}
pdflatex>
pdflatex> ! Missing = inserted for \ifnum.
pdflatex> <to be read again>
But \Jahr seems to correctly contain 2011.
