Search code examples
javadatetimejava-timezendesk

Which date time format is this?


I wonder which format is the following datetime value:

"2016-05-18T12:05:33Z"

This date time format is used on Zendesk's tickets in the fields of created_at and updated_at.

I know that its "yyyy-MM-ddTHH:mm:ss........", but what does the "Z" stand for?

What I want to do is parse and convert into a java.time class for storing dates and times, but I do not know which is the best one.


Solution

  • That is ISO 8601 format and the Z is the timezone indicator; it means UTC.

    The best java.time class to use is ZonedDateTime. Example:

    ZonedDateTime dateTime = ZonedDateTime.parse("2016-05-18T12:05:33Z",
                                                 DateTimeFormatter.ISO_DATE_TIME);