Here you can find the source of parseIso8601Date(String dateString)
public static Date parseIso8601Date(String dateString) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.SimpleTimeZone; public class Main { private static final String ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; private static final String ALTERNATIVE_ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; public static Date parseIso8601Date(String dateString) throws ParseException { try {//from w w w . ja va 2s . c o m return getIso8601DateFormat().parse(dateString); } catch (ParseException e) { } return getAlternativeIso8601DateFormat().parse(dateString); } private static DateFormat getIso8601DateFormat() { SimpleDateFormat df = new SimpleDateFormat(ISO8601_DATE_FORMAT, Locale.US); df.setTimeZone(new SimpleTimeZone(0, "GMT")); return df; } private static DateFormat getAlternativeIso8601DateFormat() { SimpleDateFormat df = new SimpleDateFormat(ALTERNATIVE_ISO8601_DATE_FORMAT, Locale.US); df.setTimeZone(new SimpleTimeZone(0, "GMT")); return df; } }