Sarah Vessels Sarah Vessels - 9 months ago 37
Java Question

What is this date format? 2011-08-12T20:17:46.384Z

I have the following date:

. What format is this? I'm trying to parse it with Java 1.4 via
and I'm getting

java.text.ParseException: Unparseable date: "2011-08-12T20:17:46.384Z"

I think I should be using SimpleDateFormat for parsing, but I have to know the format string first. All I have for that so far is
, because I don't know what the
means in this string--something time zone-related? This date string is coming from the
tag shown on Files CMIS download history media type.


The T is just a literal to separate the date from the time, and the Z means "Zulu time" (UTC). If your strings always have a "Z" you can use:

SimpleDateFormat format = new SimpleDateFormat(
    "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);

Or using Joda Time, you can use ISODateTimeFormat.dateTime().