Scrivio Interview library
ScenarioIntermediate6 min read · updated 12 November 2026

A government changes its DST rules with a few weeks notice. Your service stores future appointments. What can go wrong, and how do you keep the JVM's time zone data current?

The JVM uses its own copy of the IANA time zone database, not the operating system's, so after a rule change it keeps applying the old offsets until we update it, and future appointments computed or stored as instants with the old rules show the wrong local time. We update the JVM's rules with a JDK update or the vendor's updater tool, rebuild and redeploy container images, store future appointments as local time plus an IANA zone ID so they can be recomputed, and always use region IDs such as Europe/Paris rather than fixed offsets or abbreviations like CET.

Why this question is asked

Governments change time zone rules more often than most developers expect: abolishing daylight saving time, moving the change date, or shifting the whole country's offset, sometimes with only a few weeks of notice. For a service that books appointments months ahead, each change is a small data integrity incident waiting to happen. Interviewers ask this to see whether we know where Java gets its rules from, and whether our data model can survive a change. In this answer, we will recap where the JVM's rules live, walk through what goes wrong with stored appointments, fix the data model, and then go through how to update the rules in the JVM and in containers.

1A Quick Recap: Where the JVM Gets Its Rules

A time zone such as Europe/Paris is a list of rules: which offset from UTC applies from which date. These rules are maintained by the IANA time zone database, often called tzdata or the Olson database, which publishes several releases a year named like 2025a or 2025b.

Java's java.time classes do not read the operating system's copy of tzdata. Each JDK ships its own compiled copy, a file called tzdb.dat in the JDK's lib folder, and only that file matters to ZonedDateTime and ZoneId. So updating the server's tzdata package changes nothing for Java. We can see which version a JVM carries with one line.

Java
System.out.println(ZoneRulesProvider.getVersions("Europe/Paris").keySet()); // e.g. [2025b]

2What Goes Wrong With Stored Appointments

Imagine a country, call it Country X, whose zone is Region/City. Under the old rules, it would move to summer time, +03:00, in April. A customer books a dentist appointment at 09:00 local time on 15 June. The service converts it to an instant with the rules it knows and stores 06:00 UTC.

In May, Country X announces it is cancelling summer time; it will stay at +02:00 all year. Once the JVM has the new rules, the stored instant 06:00 UTC is displayed as 08:00 local time. The customer chose 09:00, the dentist expects them at 09:00, and our system now says 08:00. Worse, until the JVM is updated, reminders are computed with the old rules, so different services may disagree with each other depending on which JDK they run.

One appointment before and after a rule change
Old rules (+03:00)New rules (+02:00)
Customer chose15 June 09:00 local15 June 09:00 local
Stored as Instant06:00Z06:00Z (unchanged)
Displayed from Instant09:0008:00 (wrong)
Stored as local + zone ID09:00 Region/City09:00 Region/City -> 07:00Z (right)

3Fix 1: Store Future Appointments as Local Time Plus Zone

The appointment was never really a moment. It was a promise about a wall clock in a particular place: 09:00 in Country X. So we store exactly that, the local date-time and the IANA zone ID, and compute the instant only when we need it, using whatever rules are current at that time.

Java
@Entity
class Appointment {
private LocalDateTime localStart; // 2026-06-15T09:00
private String zoneId; // "Europe/Paris", always an IANA region ID
Instant startInstant() {
return localStart.atZone(ZoneId.of(zoneId)).toInstant(); // recomputed with current rules
}
}

Notice the difference from past events. When something has already happened, like a payment, the instant is the fact and Instant is the right type. For a future local time, the local time and place are the fact and the instant is derived. If we cache the instant, for example in a next_reminder_at column for fast querying, we treat it as a derived value and recompute it whenever tzdata changes.

4Fix 2: Get the New Rules Into the JVM

There are two routes. The normal one is a JDK update: vendors include new tzdata in their regular quarterly updates and sometimes in out-of-band releases when a change is urgent. The faster route is the vendor's updater tool, such as Oracle's TZUpdater; other vendors publish their own equivalent. It rewrites tzdb.dat in an installed JDK from a new IANA release without changing the JDK version. Check your vendor's tool and its support policy.

Text
# Example with Oracle's TZUpdater (check your vendor's tool and options)
java -jar tzupdater.jar -l https://data.iana.org/time-zones/releases/tzdata2025b.tar.gz
java -jar tzupdater.jar -V # prints the tzdata version now installed

After updating, every running JVM must be restarted, because the rules are loaded at startup. And the job is not done until we confirm the new version, with the getVersions line above, on a production instance.

5Fix 3: Containers Keep Old Rules Until Rebuilt

In containers, the JDK is part of the image. A service built six months ago carries the tzdata of six months ago, even if the base image has since been patched. So updating tzdata means rebuilding every affected image from an updated base image and redeploying. Services that nobody has touched in a year are exactly the ones that get missed.

So we keep an inventory: which images carry which JDK and which tzdata version. A simple startup log line or an actuator info entry with the tzdata version makes it easy to find stragglers after a change.

Step throughHandling an announced rule change
  1. IANA publishes tzdata with the change
  2. Update JDK or run vendor updater in base images
  3. Rebuild and redeploy all imagesinventory finds stale ones
  4. Verify tzdata version on each service
  5. Recompute derived instants for future eventsonly zones that changed

5 steps in order. Play them, or step through them one at a time.

6Use Region IDs, Not Offsets or Abbreviations

All of this only works if we stored a real zone ID. A fixed offset such as +03:00 has no rules, so it cannot pick up a change; it will keep producing the old offset forever. An abbreviation such as CET or EST is worse: it is often ambiguous and it describes a single offset, not a region's rules. IANA region IDs such as Europe/Paris or America/Sao_Paulo name a place, and the place's rules are what change. So the UI should let users pick a region, and the API should validate zone IDs with ZoneId.of before storing them.

7Follow-up questions

Why are three-letter zone IDs like EST discouraged?

Because they are ambiguous and they do not mean what people think. CST can mean US Central, China Standard or Cuba Standard time, and IST can mean India, Ireland or Israel. EST is a fixed -05:00 with no daylight saving, so a New York user who picks EST is an hour off all summer. Java keeps short IDs only for compatibility, through ZoneId.SHORT_IDS, and the legacy TimeZone.getTimeZone silently returns GMT for an ID it does not know, which hides typos. Region IDs avoid all of this.

If we store local time plus zone, how do we query for upcoming appointments efficiently?

We keep a derived column with the computed instant, indexed, and query on it. It is a cache of the rule, not the truth. When the tzdata version changes, a job recomputes it for future rows in the affected zones.

What about past appointments when rules change?

IANA rule changes almost always apply only from a future date, so instants in the past keep their meaning. Past events stored as instants are therefore safe; only future local times need recomputing.

8Conclusion

In this answer, we saw that the JVM carries its own tzdata in tzdb.dat, separate from the operating system, so a government rule change only reaches Java through a JDK update or the vendor's updater tool, followed by a restart, and in containers through rebuilt images. We saw that future appointments stored as instants show the wrong local time after a change, so we store them as local time plus an IANA zone ID and recompute derived instants. And we saw why region IDs, not offsets or abbreviations, are what make that possible.

What to say in the interviewAbout 80 seconds aloud

Open with

Two things can go wrong. First, the JVM doesn't use the operating system's time zone data; each JDK has its own copy of the IANA database in tzdb.dat.

Then, if they want more

So until we update the JDK's copy, our services keep applying the old rules, and different services on different JDKs may disagree. Second, if we stored future appointments as instants, those were computed with the old rules. After the change, an appointment the customer booked for 09:00 will display as 08:00 or 10:00.

So for future user-facing times I store the local date-time plus an IANA zone ID, and compute the instant when needed, with any cached instant treated as derived and recomputed after a tzdata update.

To get the new rules into Java, I'd take the vendor's JDK update if it arrives in time, or run the vendor's updater tool, like Oracle's TZUpdater, then restart the JVMs and verify the version with ZoneRulesProvider.getVersions.

In containers the JDK is baked into the image, so I would rebuild every image from an updated base and redeploy, using an inventory to find old ones. And I always use region IDs like Europe/Paris, never offsets or abbreviations like CET or EST, because only region IDs carry rules that can change.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "A government changes its DST rules with a few weeks notice. Your service stores future...": https://scrivio-interview-library.netlify.app/java/date-and-time/5a6b633280/