The Daylight Savings Time ends on Nov 1 at 2 AM in US/Eastern time zone. As a result, 2 AM becomes 1 AM.
I am not able to understand the following in the code given below:
- Why line 2 shows time 09:00, why not 10:00 (by adding 1 day)?
Why line 4 shows time 10:00, why not 09:00 (by adding 24 hours)?
LocalDateTime ld = LocalDateTime.of(2015, Month.OCTOBER, 31, 10, 0); ZonedDateTime date = ZonedDateTime.of(ld, ZoneId.of("US/Eastern")); System.out.println(date); //line 1 - 2015-10-31T10:00-04:00[US/Eastern] date = date.plus(Duration.ofDays(1)); System.out.println(date); //line 2 - 2015-11-01T09:00-05:00[US/Eastern] date = ZonedDateTime.of(ld, ZoneId.of("US/Eastern")); System.out.println(date); //line 3 - 2015-10-31T10:00-04:00[US/Eastern] date = date.plus(Period.ofDays(1)); System.out.println(date); //line 4 - 2015-11-01T10:00-05:00[US/Eastern]
Could somebody please help me with it?