ramon.carrascom
Posts: 19
Joined: Sun Aug 27, 2017 12:35 pm
Contact:

Hi,

Are OffsetDateTime and ZoneOffset in the scope of this exam?

Thank you

Posts: 8702
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

### Re: About Question enthuware.ocpjp.v8.2.2017 :

Officially, they are not but we have heard reports of a few candidates seeing them in the exam.

floryan
Posts: 8
Joined: Sun Sep 23, 2018 4:10 am
Contact:

### Re: About Question enthuware.ocpjp.v8.2.2017 :

I don't quite understand why the correct answer is "PT-1H" and not "PT1H".

The OffsetDateTime is "2017-06-02T06:00-05:00" and the ZonedDateTime is "2017-06-02T06:00-04:00".
I thought in order to calculate Duration.between, one has to count the time it takes to "get from the first to the second". If I want to go from -5 to -4 then I'd add +1. Or in other words, if clocks are one hour ahead due to summer time e.g. 2am instead of 1am, it seems more logical to me to add +1 to get from 1am to 2am.

EDIT: found an explanation here -> viewtopic.php?f=2&t=4237

lukacsa82
Posts: 1
Joined: Mon Aug 19, 2019 6:02 pm
Contact:

### Re: About Question enthuware.ocpjp.v8.2.2017 :

Duration.between(date1, date2) does subtraction. In this case it means date1-date2 which is -5-(-4) = -5+4 = -1