# Is it possible to parse a date string in LaTeX to convert it to a different date format?

I’m using svn-multi to include the date of the most recent Subversion commit of my documents. However, the string has the format 2013-10-13 11:05:51 +0200 (Sun, 13 Oct 2013). Is it possible to convert this string to the same date format that is used by \today?

Here is a minimal working example (Subversion inserts the date automatically before a commit):

\documentclass{article}

\usepackage{svn-multi}
\svnidlong
{$LastChangedBy: mcb$}
{$LastChangedRevision: 23$}
{$LastChangedDate: 2013-10-13 11:05:51 +0200 (Sun, 13 Oct 2013)$}
{$HeadURL: http://example.org$}

\title{Sample Document}
\author{Sample}
\date{\svndate}

\begin{document}

\maketitle

\end{document}

-
Can you add a minimal working example (MWE)? –  egreg Oct 13 '13 at 10:06
I suggest you to follow this nice tutorial here There was also an equivalent question on tex.stackexchange here, and here for the parsing, that might help you. Should you have any further problem, please do not hesitate let us know. A Mininum Working Example ([MWE](meta.tex.stackexchange.com/questions/228/… –  Header12 Oct 13 '13 at 10:08
pgf/tikz has a date library which can parse dates. It cannot parse times, though. The parsed date can be reformatted as needed. –  Christian Feuersänger Oct 13 '13 at 11:08

\documentclass{article}

\usepackage{datetime}

\def\parsecommitdate#1-#2-#3 #4:#5:#6 #7\endparse{%
\date{\formatdate{#3}{#2}{#1}}%
}

\newcommand{\svndate}{2013-10-13 11:05:51 +0200 (Sun, 13 Oct 2013)}

\title{Sample Document}
\author{Sample}

\begin{document}

% Since \svndate is not available in the preamble the date must be set in the document environment.
\expandafter\parsecommitdate\svndate\endparse

\maketitle

\end{document}

-
This works really well, thank you. However, it does not work together with the \svndate (which just prints the date string). The error message is: Paragraph ended before \parsecommitdate was complete. –  mcb Oct 13 '13 at 10:37
@mcb You need to expand \svndate before it can be parsed. It \svndate is a one level expansion of the formatted date you can just put \expandafter before \parsecommitdate. –  Nicola Talbot Oct 13 '13 at 10:43
It doesn’t seem to work with the MWE above. –  mcb Oct 13 '13 at 11:13
@mcb It compiles fine for me. In what way does it not work for you? (Does it give an error message or produce unexpected output?) –  Nicola Talbot Oct 13 '13 at 12:14
@NicolaTablot Still the same error: Paragraph ended before \parsecommitdate was complete. (I just copied my MWE from above and added package, definition from your answer and replaced the line with the date.) –  mcb Oct 13 '13 at 12:23