Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817
Moderator: admin
rlobato
Posts: 10 Joined: Fri Jun 28, 2024 3:08 am
Contact:
Post
by rlobato » Mon Nov 18, 2024 2:33 am
Whatever is the time is currently in NY, the same time happens 3 hours later in LA.
Isn't it the other way around? "Given that New York is 3 hours ahead of Los Angeles"
Cheers
admin
Site Admin
Posts: 10384 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Mon Nov 18, 2024 5:44 am
No. It is correct. NY is ahead, which means, LA is later. So, if it is 9AM in NY now, then the clock will sound 9AM in LA three hours from now.
raphaelzintec
Posts: 167 Joined: Sun Apr 21, 2024 10:43 am
Contact:
Post
by raphaelzintec » Sun Feb 23, 2025 4:40 am
i really dont understand how Ny is 3 hours ahead LA but for duration.between LA is higher....
it's like black and white, 1+1=2, NY > LA by 3 hours, but LA bigger...
admin
Site Admin
Posts: 10384 Joined: Fri Sep 10, 2010 9:26 pm
Contact:
Post
by admin » Sun Feb 23, 2025 5:23 am
LA is not "bigger". As the explanation says, Duration.between method can be a negative period if the end is before the start. To find the duration.between, you need to get both the first argument and second argument at the same base line. let's say our base line is NY time. So, 6AM in LA is actually 9 AM in NY. Thus, the second argument (9AM) is NOT before the first argument (6AM). Therefore, the difference will be positive 3 Hours.
raphaelzintec
Posts: 167 Joined: Sun Apr 21, 2024 10:43 am
Contact:
Post
by raphaelzintec » Mon Feb 24, 2025 7:07 pm
thank you for the explanation
now i understand better with "before" term instead of "smaller/bigger"
NY is before LA with 3 hours ahead so LA is behind and NY is first param so positive
very easy now thank you
Users browsing this forum: No registered users and 9 guests