Page 1 of 1

About Question enthuware.ocpjp.v21.2.3791 :

Posted: Thu Feb 20, 2025 8:19 am
by tinohe
Hello,
this explanation is wrong imho here:
"date1.compare(date2) will return second date minus first date in seconds i.e. -3600, which, if converted to hours will be -1."

The code doesn't compare the dates, but the ZoneOffsets of these dates. That means -14400 seconds compareTo -18000 seconds = -3600 seconds which equals to -1 hour

Re: About Question enthuware.ocpjp.v21.2.3791 :

Posted: Thu Feb 20, 2025 9:01 am
by admin
But the explanation doesn't say it compares "Dates". It is just showing a trick to find out the answer. It does return a value that can be determined if you do second "date" (date with smallcase d) minus first date in seconds.

What if date1 and date2 have same zoneoffsets?

Re: About Question enthuware.ocpjp.v21.2.3791 :

Posted: Fri Jun 13, 2025 7:59 am
by nkaragulov
I know -4 is greater than -5. But concerning offset it comes out that -5:00 is greater than -4:00
I don't get it.

Re: About Question enthuware.ocpjp.v21.2.3791 :

Posted: Fri Jun 13, 2025 7:59 pm
by admin
Dates are not greater or smaller. They are before or after.