About Question enthuware.ocpjp.v8.2.1760 :
Posted: Sat Jul 11, 2020 5:00 am
Hi,
I have found this question in your mock exam:
And the result is
What I do not understand is the last line of output. I know that always you should subtract the offset time zone from the actual time. So if your offset is negative you will add (- * - = +) the offset and if the offset is positive you will subtract (- * + = -).
In this case the offset is negative so from my point of view we should add 2 hr to our final result and to get 19:13:20 and not 15:13:30
What I am missing here?
I have found this question in your mock exam:
Code: Select all
Instant start = Instant.parse("2015-06-25T16:13:30.00z");
start.plus(10, ChronoUnit.HOURS);
System.out.println(start);
Duration timeToCook = Duration.ofHours(1);
Instant readyTime = start.plus(timeToCook);
System.out.println(readyTime);
LocalDateTime ltd = LocalDateTime.ofInstant(readyTime, ZoneId.of("GMT-2"));
System.out.println(ltd);
First 2 lines of output are as expected for me.2015-06-25T16:13:30Z
2015-06-25T17:13:30Z
2015-06-25T15:13:30
What I do not understand is the last line of output. I know that always you should subtract the offset time zone from the actual time. So if your offset is negative you will add (- * - = +) the offset and if the offset is positive you will subtract (- * + = -).
In this case the offset is negative so from my point of view we should add 2 hr to our final result and to get 19:13:20 and not 15:13:30
What I am missing here?