Page 1 of 1

About Question enthuware.ocpjp.v8.2.1748 :

Posted: Wed Dec 28, 2016 12:39 pm
by Tanooki
Why is the answer 9:00 & 10:00?

I don't see the Period.ofDays() adding 24 hours instead of 23?

In the US/Eastern timezone it will be 9:00 am in the morning 1 day later, since there is a shift because of DST at 2 AM in the morning on the 1st of november.

So why is plus'ing a Duration.ofDays(1) different from plus'ing a Period.ofDays(1)?

Re: About Question enthuware.ocpjp.v8.2.1748 :

Posted: Thu Dec 29, 2016 1:24 am
by admin
There is a conceptual difference between the two - A Duration measures an amount of time using time-based values (seconds, nanoseconds). A Period uses date-based values (years, months, days).
When you add Period, you are increasing the date and not bothered about the time passed to reach that date. When you add Duration, you are adding time, the date so arrived at is secondary.