About Question enthuware.ocpjp.v8.2.1749 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
lveto15
Posts: 27
Joined: Tue Sep 22, 2015 1:01 pm
Contact:

About Question enthuware.ocpjp.v8.2.1749 :

Post by lveto15 »

My answer was mark as incorrect, so I have run this example, with some extra loggin:

Code: Select all

LocalDateTime ld1 = LocalDateTime.of(2015,Month.NOVEMBER,1,2,0);
ZonedDateTime z1 = ZonedDateTime.of(ld1, ZoneId.of("US/Eastern"));
System.out.println(z1);

LocalDateTime ld2 = LocalDateTime.of(2015,11,1,1,0);
ZonedDateTime z2 = ZonedDateTime.of(ld2, ZoneId.of("US/Eastern"));
System.out.println(z2);

System.out.println(ChronoUnit.HOURS.between(ld1,ld2));
Result was:
2015-11-01T02:00-05:00[US/Eastern]
2015-11-01T01:00-04:00[US/Eastern]
-1
To achieve answer mark as correct, the line:

Code: Select all

long x = ChronoUnit.HOURS.between(ld1,ld2);
has to be changed to:
long x = ChronoUnit.HOURS.between(zd1,zd2);

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right. Fixed.
thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest