Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

You can use JLink (as already mentioned while I read JavaDoc). Searching StackOverflow brings up this highly voted answer

Converting ISO8601-compliant String to java.util.DateConverting ISO8601-compliant String to java.util.Date

I don't know whether it covers the whole standard but this works out of the box. If this is not sufficient, you can use an equivalent piece of code written for Joda Time

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)

You can use JLink (as already mentioned while I read JavaDoc). Searching StackOverflow brings up this highly voted answer

Converting ISO8601-compliant String to java.util.Date

I don't know whether it covers the whole standard but this works out of the box. If this is not sufficient, you can use an equivalent piece of code written for Joda Time

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)

You can use JLink (as already mentioned while I read JavaDoc). Searching StackOverflow brings up this highly voted answer

Converting ISO8601-compliant String to java.util.Date

I don't know whether it covers the whole standard but this works out of the box. If this is not sufficient, you can use an equivalent piece of code written for Joda Time

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)
added 425 characters in body
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

You can use JLink (as already mentioned while I read JavaDoc). Searching StackOverflow brings up this highly voted answer

Converting ISO8601-compliant String to java.util.Date

I don't know whether it covers the whole standard but this works out of the box. If this is not sufficient, you can use an equivalent piece of code written for Joda Time

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@
    getTime[]@toString[]javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)

You can use JLink (as already mentioned while I read JavaDoc).

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@
    getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)

You can use JLink (as already mentioned while I read JavaDoc). Searching StackOverflow brings up this highly voted answer

Converting ISO8601-compliant String to java.util.Date

I don't know whether it covers the whole standard but this works out of the box. If this is not sufficient, you can use an equivalent piece of code written for Joda Time

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

You can use JLink (as already mentioned while I read JavaDoc).

Needs["JLink`"]

ParseDateString[date_String] := JavaBlock[
  InstallJava[];
  LoadJavaClass["javax.xml.bind.DatatypeConverter", 
   StaticsVisible -> True];
  DateList[
   javax`xml`bind`DatatypeConverter`parseDateTime[date]@
    getTime[]@toString[]
  ]
]

This uses the DataypeConverter class which is available without in standard Java 6. It converts it into a standard date string which can then be used with DateList.

ParseDateString["2010-01-01T12:00:00Z"]

(* {2010, 1, 1, 13, 0, 0.} *)