nadine87
nadine87

Reputation: 530

Microsoft Graph API DateTimeZone date format

Microsoft Graph API uses a DateTimeZone class for dates and it has a format similar to 2017-12-21T14:30:00.0000000.

How do I detect which format this is in order to create events from an Android application?

Upvotes: 1

Views: 4347

Answers (1)

fmaccaroni
fmaccaroni

Reputation: 3916

The DateTime is in the format defined by ISO 8601.

If you want to parse that to Date then you can use (Java 8 at least):

DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_DATE_TIME;
TemporalAccessor temporalAccessor = timeFormatter.parse("2017-12-21T14:30:00.0000000");

Date date = Date.from(Instant.from(temporalAccessor));

Upvotes: 3

Related Questions