I have an API which returns a date along with many other values. For dates prior to the year 1906 (eg: 1905-12-12) it returns a time format which has seconds in the time zone part. Here's my method:
public static void main(String[] args) throws FileNotFoundException {
Instant testDate = Instant.parse("1905-12-29T23:00:00Z");
String testFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME
.format(ZonedDateTime.ofInstant(testDate, ZoneId.systemDefault()));
System.out.println(testFormat);
}
Above code prints:
1905-12-30T04:21:10+05:21:10
As my default time zone is Asia/Kolkata (+5:30) I expected the date to be
1905-12-30T04:21:10+05:30
When I am parsing the date 1905-12-30T04:21:10+05:21:10 in C#, it says invalid date value.
Does any one else have faced this issue?