Skip to content
Sharp

API Evolution · interview question

Given a LocalDate of a product launch date, how would you express the same date in the 'America/New_York' timezone?

Multiple choiceMediumchapter-12-curatedpremiumapi-evolutionmodern-date-and-time
Choose one answer
Answer and explanation

Correct answer

D. Use LocalDate.atStartOfDay(ZoneId.of('America/New_York'))

Why

The method LocalDate.atStartOfDay(ZoneId zone) converts a LocalDate to a ZonedDateTime at the start of the day within the specified time zone.

Test yourself on API Evolution

A free test with instant, explained results. No account needed.

Start free test
All API Evolution questions →