← Quiz: Date and Time in Java: all 10 questions
Quiz: Date and Time in Java · Question 9 of 10
A video call is fixed for 10:00 in India. What should you use to show the time for a friend in London?
A video call is fixed for 10:00 in India. What should you use to show the time for a friend in London?
- A.LocalDateTime.plusHours(5)
- B.LocalTime.minusMinutes(330)
- C.ZonedDateTime with Asia/Kolkata, then withZoneSameInstant(ZoneId.of("Europe/London"))
- D.Instant.now()
Answer & explanation
Correct answer: ZonedDateTime with Asia/Kolkata, then withZoneSameInstant(ZoneId.of("Europe/London"))
The zone rules know the current offset, including daylight saving in London; manual arithmetic gets this wrong for part of the year.
Can you get the rest right without peeking?
Take the timed Quiz: Date and Time in Java quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →