I am using the following code to get the date in ISO-8601 format. For UTC the value returned does not contain offset.
OffsetDateTime dateTime = OffsetDateTime.ofInstant(
Instant.ofEpochMilli(epochInMilliSec), zoneId);
return dateTime.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
For other time formats the response returned looks like:
2016-10-30T17:00:00-07:00
In case of UTC the value returned is:
2016-10-30T17:00:00Z
I want it to be:
2016-10-30T17:00:00+00:00
Note: Do not use UTC-0 as -00:00 is not ISO8601 compliant.