2

I'm retrieving JSON from Azure and receive the date as 1900-01-01T16:00:00.000Z for example. Now this part of a JSONObject, but how do I correctly parse this into the Java date format?

Thanks for any ideas

User24231
  • 506
  • 1
  • 7
  • 20
  • Looks like ISO 8601 format. Use javax.xml.bind.DatatypeConverter.parseDateTime - See http://stackoverflow.com/questions/2201925/converting-iso8601-compliant-string-to-java-util-date – lreeder Aug 13 '13 at 18:21

1 Answers1

0

Take the date as a String from the Json then parsed it using SimpleDateFormat:

SimpleDateFormat sdf=new SimpleDateFormat("/*Look at the API for the format*/");
Date jsonDate= sdf.parse(/*Date as String from your JSON*/);

To find the correct format you can have a look to this question simpledateformat parsing date with 'Z' literal.

Community
  • 1
  • 1
Benoit Wickramarachi
  • 6,096
  • 5
  • 36
  • 46