🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.LocalDateTime.plusHours(5)
  2. B.LocalTime.minusMinutes(330)
  3. C.ZonedDateTime with Asia/Kolkata, then withZoneSameInstant(ZoneId.of("Europe/London"))
  4. 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 →