javadatedatetimedatetime-formattimezone-offset

What is the Z ending on date strings like 2014-01-01T00:00:00.588Z


Im doing a fetch to get a date from a database in java (the date should always be 2014-01-01T00:00:00). I'm getting the following time returned: 2014-01-01T00:00:00.588Z.

My questions is, what is the "588Z" at the end? and would this number be different the retrieve was done in a different timezone? i.e. would the number 588 be a different number in a different time zone.

Thanks for any help I may get.


Solution

  • The Z stands for the zero UTC offset.

    If the time is in UTC, add a Z directly after the time without a space.
    Z is the zone designator for the zero UTC offset.
    "09:30 UTC" is therefore represented as "09:30Z" or "0930Z", while "14:45:15 UTC" would be "14:45:15Z" or "144515Z".

    The portion immediately before the Z translates into fraction of second; here, 588.

    From your question above, 00:00:00.588 means "about a half second past midnight", with the last three digits after the period, 588, translating: milliseconds.

    ... more details here on (ISO 8601 standard).