Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Dates have been exchanged between your systems as epoch seconds, epoch millis, ISO-8601 strings, locale-formatted strings and database-native types. What single data-format standard would you set for the next decade, and how do you migrate without breaking consumers?

Machine data uses ISO-8601: instants as UTC strings like 2025-03-10T08:00:00Z and calendar dates as plain ISO dates like 2025-03-10, while locale formatting happens only for display at the edge. Schemas declare the type explicitly, for example a timestamp logical type in Avro or format date-time in JSON Schema. We migrate by adding new fields in the standard format alongside the old ones, moving consumers over and then deprecating and removing the old fields, with shared serialisers and contract tests preventing regressions.

Why this question is asked

A date format standard is one of those decisions that outlives the people who make it. Formats chosen today will be in event logs, archived files and partner contracts for a decade. Interviewers ask senior leaders this because it combines a technical choice with a long migration across teams who cannot all move at once. In this answer, we will look at what each of the current formats costs, choose a standard by kind of value, make schemas carry the type, plan a migration that never breaks a consumer, and put the tooling in place that keeps the standard alive.

1What the Current Mix Costs

Each format in use today has a specific failure mode. Epoch seconds and epoch millis look the same in a payload, a long number, and a consumer that guesses the wrong unit is off by a factor of a thousand, landing in 1970 or in the year 57000. Locale-formatted strings such as 03/10/2025 mean 10 March in the US and 3 October in most of Europe, and their exact text changes when locale data is updated. Database-native types depend on driver and session time zone settings. Only the ISO-8601 strings are self-describing.

The cost is not only bugs. Every consumer of every field writes and maintains its own conversion, and every new engineer has to learn which field uses which format. A single standard removes that whole layer of accidental work.

2The Standard: One Format per Kind of Value

We define the standard by what a value means, not by which type a language happens to offer. An instant, a moment on the global timeline, is an ISO-8601 string in UTC with the Z suffix, using the RFC 3339 profile that most tools implement. A calendar date with no time, such as a birthday or an invoice date, is an ISO date. A future local time, such as an appointment, is a local date-time plus an IANA zone ID, because converting it to an instant early would freeze today's zone rules.

We also decide precision, because a decade is long enough for it to matter. Java's Instant has nanoseconds, PostgreSQL stores microseconds and many JavaScript clients work in milliseconds. A sensible rule is that producers may send up to microsecond precision and consumers must accept any number of fractional digits.

The data-format standard
Kind of valueIn JSON and textIn binary schemasNever
Instant (moment)2025-03-10T08:00:00ZAvro timestamp-microsepoch number without declared unit
Calendar date2025-03-10Avro date03/10/2025
Future local time2026-05-12T09:00 + Europe/Parislocal-timestamp + zone fieldlocal time without zone
Display textonly in the UI, user's localenever storedin data exchanged between systems

3Locale Formatting Only at the Edge

The rule that keeps the standard simple is that locale-formatted text never crosses a system boundary. A service returns 2025-03-10T08:00:00Z, and the browser or mobile app formats it as '10 March 2025, 09:00' or '3/10/25, 4:00 AM' for its user. The reason is that display text depends on the reader's language, zone and preferences, and on locale data that changes between platform versions. Data exchanged between systems must not change when someone upgrades a JDK.

Java
// Producer: always the standard format
record InvoiceIssued(String invoiceId, Instant issuedAt, LocalDate dueDate) {}
// {"invoiceId":"INV-7","issuedAt":"2025-03-10T08:00:00Z","dueDate":"2025-04-09"}
// Edge (UI service): format for a person, never stored or forwarded
String shown = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)
.withLocale(userLocale).withZone(userZone).format(event.issuedAt());

4Schemas Declare the Type

A standard that lives only in a wiki is ignored. So every schema states the type of every time field explicitly. In JSON Schema and OpenAPI, an instant is a string with format date-time and a calendar date is a string with format date. In Avro, a binary format, we use the logical types: timestamp-millis or timestamp-micros for instants, which store a number but declare its unit in the schema, and date for calendar dates. Notice that the Avro number is acceptable precisely because the unit is in the schema, which is the thing a bare epoch number in JSON lacks.

Java
// JSON Schema
"issuedAt": { "type": "string", "format": "date-time" },
"dueDate": { "type": "string", "format": "date" }
// Avro
{ "name": "issuedAt", "type": { "type": "long", "logicalType": "timestamp-micros" } },
{ "name": "dueDate", "type": { "type": "int", "logicalType": "date" } }

Schema registries and API linters can then enforce rules, such as rejecting new fields whose names end in 'At' or 'Date' without one of these types.

5Migrating Without Breaking Consumers

We never change the format of an existing field in place, because some consumer somewhere parses the old format and breaks. Instead, the producer adds a new field in the standard format next to the old one, for example issuedAt beside issued_epoch_ms, and fills both. In Avro, adding a field with a default is a compatible schema change, and JSON consumers ignore fields they do not know. Consumers move to the new field on their own schedule.

The producer then marks the old field deprecated in the schema and documentation, measures who still reads it, for example from consumer registrations or contract tests, and removes it after a published deadline, typically one or two release cycles. For long-lived data, such as event logs and archived files, we keep a converter that reads the old formats, because old records will be replayed for years.

Step throughMigrating one field
  1. Inventory the field and its true meaninginstant, date or future local time
  2. Add new standard field alongsideproducer fills both
  3. Consumers switchtracked per consumer
  4. Mark old field deprecatedwith a removal date
  5. Anyone still reading it?
    YesContact team, help, extend onceNoRemove old field
  6. Keep a reader for archived dataold events replay for years

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

6Keeping the Standard Alive

Over a decade, the main risk is drift: a new team, a new language, a new message broker. Shared serialisers, a small library per language that configures JSON and Avro mapping the standard way, make the right format the default. Contract tests in each producer's build check that sample payloads validate against the schema and that time fields use the declared format, so a regression fails the build rather than a consumer. A named owner reviews the standard yearly, using incidents and new technologies as input.

7Follow-up questions

Why ISO strings instead of epoch milliseconds, which are smaller and faster to parse?

In text formats such as JSON, ISO strings are self-describing, readable in logs and support tickets, and carry their unit and zone in the value itself. Their size and parse cost are negligible next to network and serialisation overhead. Where size and speed matter, in binary formats, we do use numbers, but with a logical type in the schema so the unit is declared.

What about consumers we do not control, such as external partners?

External contracts change on the partner's schedule, so we put an adapter at the boundary that converts between their format and our standard. Inside, everything uses the standard; the partner format lives in one place with its own tests.

Should a calendar date ever be sent as an instant, such as midnight UTC?

No. A date like a birthday has no time and no zone; turning it into midnight UTC makes it shift a day for consumers in western time zones when they convert it back. Calendar dates travel as ISO dates.

8Conclusion

In this answer, we set one format per kind of value: ISO-8601 UTC strings for instants, ISO dates for calendar dates, local date-time plus zone ID for future local times, and locale formatting only for display at the edge. Schemas declare these types explicitly through JSON Schema formats or Avro logical types. We migrate by adding standard fields alongside old ones, moving consumers, then deprecating and removing the old fields while keeping readers for archived data, and shared serialisers, contract tests and a named owner keep the standard from drifting.

What to say in the interviewAbout 80 seconds aloud

Open with

I'd set the standard by the meaning of the value. Instants travel as ISO-8601 strings in UTC, like 2025-03-10T08:00:00Z, calendar dates as ISO dates like 2025-03-10, and future local times as a local date-time plus an IANA zone ID.

Then, if they want more

Locale-formatted text is only for display at the edge, in the UI, never in data between systems, because it depends on the reader and on locale data that changes between versions.

Schemas have to declare the types: format date-time or date in JSON Schema and OpenAPI, and logical types like timestamp-micros and date in Avro, where a number is fine because the schema states the unit. For the migration, I'd never change an existing field in place.

The producer adds the new field in the standard format next to the old one and fills both, consumers switch at their own pace, the old field is deprecated with a published removal date, and we track who still reads it before removing it. For archived data and event replays we keep a reader for the old formats.

To keep it from drifting over ten years, we provide shared serialisers per language, contract tests that validate payloads against schemas in each producer's build, and a named owner who reviews the standard every year.

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 "Dates have been exchanged between your systems as epoch seconds, epoch millis, ISO-8601...": https://scrivio-interview-library.netlify.app/java/date-and-time/6ba4763cb3/