I have a string "2020-03-25T22:00:00.000Z" which i want to convert to OffsetDateTime. Below is the code I tried but when I pass milisecond as 000 then it is not reflecting in OffsetDateTime.
OffsetDateTime offsetDateTime=OffsetDateTime.parse("2020-03-25T22:00:01.123Z",
DateTimeFormatter.ISO_OFFSET_DATE_TIME);
print(offsetDateTime)
//Output: 2020-03-25T22:00:01.123Z
But when mili is 000 then
OffsetDateTime offsetDateTime=OffsetDateTime.parse("2020-03-25T22:00:01.000Z",
DateTimeFormatter.ISO_OFFSET_DATE_TIME);
print(offsetDateTime)
//Output: 2020-03-25T22:01Z (mili second is missing)
I tried custom formattter also but it behave same
OffsetDateTime.parse("2020-03-25T22:00:00.123Z",
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX"));
Can anyone please help me out