I want to build upon @halirutan answer.
The reason why I need to build upon the answer is DatatypeConverter`parseDateTime actually returns in the following format "Mon Mar 10 21:24:10 GMT+08:00 2014", and DateList[] can't automatically interpret the returned date
Hence, I need to provide the explicit format to DateList[] to make it work in Mathematica. The explicit format is "{"DayName"," ","MonthName"," ","Day"," ", "Hour",":","Minute",":","Second"," GMT+08:00 ", "Year"}"
Please take note of the Time Zone portion. My time zone is GMT+08:00, hence I hard coded it in the explicit format. Most likely you need to update to your own time zone for it to work successfully. For example, your time zone is GMT-08:00 if you are in USA West Coast.
Needs["JLink`"]
ParseDateString[date_String] := JavaBlock[
InstallJava[];
LoadJavaClass["javax.xml.bind.DatatypeConverter",
StaticsVisible -> True];
DateList[{
javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[],
{"DayName", " ", "MonthName", " ", "Day", " ", "Hour", ":", "Minute",":", "Second", " GMT+08:00 ", "Year"}}
]
]
ParseDateString["2014-03-10T09:24:10.000-04:00"]
And the result will be
{2014, 3, 10, 21, 24, 10.}
findMathematica
for cmake ;-) You cannot imagine how easy life is with your tool. $\endgroup$