# date interpretation from numbers to regular

I was wondering if there exists such a package, or an option, to write the date in the form 31.1.2012 for example, and then have LaTeX present it as "January 31, 2012". I am actually using LyX and there is an "environment" to put date, However, it puts it in the same manner I am writing it, and for ease of writing I would like to write only numbers.

-

## 1 Answer

How about this?

\documentclass{article}
\usepackage{datetime}
\usdate
\def\mydate#1{\innermydate#1}
\def\innermydate#1.#2.#3{\formatdate{#1}{#2}{#3}}
\begin{document}
\mydate{31.1.2001}
\end{document}


The datetime package provides the commands \usdate and \formatdate (note that \usdate redefines \today). The macro \innermydate sets up the format in which to input dates. You could say \innermydate1.1.2001 but the syntax with braces is nicer in my opinion, so I borrowed a neat trick from this answer to facilitate it.

-
Thanks. It does work for LaTex, however in LyX it is a problem, since I can't use 'mydate' inside the document (I can write a 'TeX' line inside, but it doesn't output well). Is there a simple solution that will be convenient with LyX? – Stewie Jan 31 '12 at 14:15
I'm afraid I don't know. I can only answer the LaTeX part. I hate LyX! – Ian Thompson Jan 31 '12 at 14:25