For example when I am trying to print such OffsetDateTime:
OffsetDateTime offsetDateTime = OffsetDateTime.of(2018, 3, 18, 0, 0, 0, 0, ZoneOffset.UTC);
output is:
2018-03-18T00:00Z
instead of
2018-03-18T00:00:00.000Z
Maybe you know are there any easier way to do it then implement own toString/converter method?
From Java API: format(DateTimeFormatter formatter) Formats this date-time using the specified formatter.
I would guess the easiest for you would be to use:
OffsetDateTime.of(2018, 3, 18, 0, 0, 0, 0, ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With