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?

  • $\begingroup$ The October version works on my end. What version of Mathematica are you on? $\endgroup$ Commented Nov 17, 2012 at 16:19
  • $\begingroup$ Both lines also work on version 7. $\endgroup$
    – Mr.Wizard
    Commented Nov 17, 2012 at 16:22
  • $\begingroup$ Works here too. $\endgroup$
    – rm -rf
    Commented Nov 17, 2012 at 16:44
  • 5
    $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Commented Nov 17, 2012 at 16:54
  • $\begingroup$ (With non English locals it doesn't simply use the month names I another language. Often parsing is just broken :( ) $\endgroup$
    – Szabolcs
    Commented Nov 17, 2012 at 16:57

1 Answer 1


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

  • $\begingroup$ It works! I'm glad it wasn't some simple typo i made... $\endgroup$ Commented Nov 17, 2012 at 21:27
  • $\begingroup$ Is it in some way not wise to start mma alway with this command? $\endgroup$ Commented Nov 17, 2012 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.