ReviseAlgo Logo

Date & Time API

ZonedDateTime

Manage date and time with full timezone support and DST adjustments.

Interview: Commonly tested on ZoneId lookup, timezone offsets, and converting between different timezones (withZoneSameInstant).

Last Updated: June 13, 2026 10 min read

ZonedDateTime represents a date and time with a full timezone offset and zone rules (e.g. '2026-06-13T14:30-04:00[America/New_York]').

Core Idea

ZonedDateTime pairs a LocalDateTime with a ZoneId, resolving offset offsets and daylight saving transitions.

Why It Matters

Essential for flight booking systems or international meeting coordinators operating across timezones.

Interview Lens

Focuses on ZoneId names vs. Offset hours, and converting a zoned time to another timezone.

Timezone Conversion

To shift a time to a different timezone while preserving the exact same moment on the timeline, use:

This resolves DST offsets and returns a new ZonedDateTime instance.

Code Walkthrough

This program demonstrates converting a meeting time from Eastern Time to Paris Time.

Interview-Relevant Information

Q: What is the difference between ZoneOffset and ZoneId?
Answer: A ZoneOffset represents a simple difference from UTC (e.g. `+05:30`). A ZoneId represents a full timezone region (e.g. `Asia/Kolkata`) containing historical transition rules, offsets, and DST adjustments. Always prefer ZoneId for calendar calculations.

Quick Checklist

How do you convert a ZonedDateTime to another zone? What is the difference between ZoneOffset and ZoneId? If yes, you understand ZonedDateTime.

Use Cases

Scheduling international video calls across timezones.

Calculating flight arrival times across different destination zones.

Common Mistakes

Using withZoneSameLocal() instead of withZoneSameInstant() when shifting timezones (withZoneSameLocal keeps the clock numbers, modifying the physical moment on the timeline).

Hardcoding timezone offsets (like +02:00) instead of using region names (like Europe/Berlin), which bypasses DST updates.