Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

DateList experiences some strange behavior which i cannot explain. This code works fine:

DateList[{"2012September1211:45:26", {"Year", "MonthName", "Day", 
   "Hour", ":", "Minute", ":", "Second"}}]


{2012, 9, 12, 11, 45, 26.}

But this code doesn't work:

DateList[{"2012October1211:45:26", {"Year", "MonthName", "Day", 
   "Hour", ":", "Minute", ":", "Second"}}]

Returning this error message:

DateString::str: String 2012October1211:45:26 cannot be interpreted as a date in format {Year,MonthName,Day,Hour,:,Minute,:,Second}. >>

The only thing i changed is the month from september to october.

Really frustrating, i'm already staring at it for 2 hours...

Question: What am i doing wrong?

share|improve this question
The October version works on my end. What version of Mathematica are you on? – J. M. Nov 17 '12 at 16:19
Both lines also work on version 7. – Mr.Wizard Nov 17 '12 at 16:22
Works here too. – R. M. Nov 17 '12 at 16:44
I had lots of problems with date parsing functions that others couldn't reproduce. It turns out how these work depends on the regional settings of your system! You'll only get the documented behaviour on Windows with a US English locale. – Szabolcs Nov 17 '12 at 16:54
(With non English locals it doesn't simply use the month names I another language. Often parsing is just broken :( ) – Szabolcs Nov 17 '12 at 16:57
up vote 3 down vote accepted

Solution credit to Szabolcs comment!

If you are on linux you can fix this by starting mathematica from your terminal as:

export LANG=en_US.UTF-8; mathematica

Or if it is not in your path:

export LANG=en_US.UTF-8; /Directory/To/Mathematica/Version/Executables/Mathematica

share|improve this answer
It works! I'm glad it wasn't some simple typo i made... – Aart Goossens Nov 17 '12 at 21:27
Is it in some way not wise to start mma alway with this command? – Aart Goossens Nov 17 '12 at 21:28

Your Answer


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.