Skip to content

Dates and Time Zones in Data Pipelines: Store UTC, Convert Late

One central UTC clock converted into several local time zone clocks.

Few things break reports as quietly as time. A day with 23 hours, an event that lands in the wrong month, two dashboards that disagree because one counts midnight in London and the other in New York. Handling dates and time zones deliberately is one of the cheapest ways to make a pipeline trustworthy.

Store everything in UTC

The safest default is to store timestamps in UTC, the universal reference time, and to convert to a local time zone only when you show data to a person. UTC has no daylight saving changes, so timestamps sort correctly and subtract cleanly. Storing local times without recording their zone is a common source of errors that cannot be fixed later, because the information needed to correct them is gone.

Time zone versus offset

An offset such as +05:00 is a fixed difference from UTC at one moment. A time zone such as America/New_York is a set of rules that includes daylight saving changes, so its offset changes during the year. To convert a timestamp for display or to decide which local day it belongs to, you need the named zone, not just the offset it had when it was recorded.

Daylight saving time

When clocks move forward, one local hour does not exist, and when they move back, one local hour happens twice. Daily totals in local time can therefore cover 23 or 25 hours, and a local timestamp during the repeated hour is ambiguous. Doing arithmetic and storage in UTC avoids most of these problems, and conversion to local time becomes a display step.

A short Python example

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

ts = datetime(2026, 3, 8, 12, 0, tzinfo=timezone.utc)
local = ts.astimezone(ZoneInfo("America/New_York"))
print(ts.isoformat(), local.isoformat())

The first value stays in UTC, and the second shows the same instant in New York. Prefer timezone-aware datetime objects like these, and be wary of naive ones, which carry no zone information and are silently assumed to be local time by some tools.

Use ISO 8601 for text

When timestamps move between systems as text, use the ISO 8601 format, such as 2026-03-08T12:00:00Z or with an explicit offset. It is unambiguous, sorts correctly as a string and is understood by almost every library. Ambiguous formats such as 03/04/2026 mean different dates in different countries.

Decide which day an event belongs to

A purchase at 23:30 UTC is already the next day in much of Asia. For reporting, decide which time zone defines a business day and apply it consistently, often the company’s operating zone, and truncate dates in that zone, not in UTC. Two teams reporting the same metric with different day boundaries will never reconcile, which is a consistency problem of the kind listed in data quality dimensions.

Event time and processing time

Record when an event happened, when your system received it, and when it was loaded. These differ, and mixing them up causes late data to land in the wrong period. The distinction is central to streaming, as covered in batch vs streaming data processing, and it determines which rows an incremental load should pick up.

Reruns and backfills

Pipelines that process one day at a time need a clear definition of that day, including its time zone, so that rerunning yesterday produces the same result today, as required by idempotent data pipelines. Passing the date window in as an explicit parameter, instead of using the current time inside the job, makes backfills straightforward.

Time in analytics and forecasting

Seasonality such as weekday patterns only shows up correctly if timestamps are assigned to the right local day, which matters for time series forecasting baselines and for grouping data into cohorts, as in cohort analysis in SQL.

A quick checklist

  1. Are timestamps stored in UTC, with local conversion only for display?
  2. Do you use named time zones, not fixed offsets, for local conversion?
  3. Is the business day’s time zone defined and used consistently?
  4. Are timestamps exchanged in ISO 8601 format?
  5. Do you record event time separately from load time?
  6. Do runs take their date window as a parameter?

If you want a pipeline built with these details handled, see my ETL and ELT engineering service.

FAQ

Should I store timestamps in UTC or local time?
Store them in UTC. UTC has no daylight saving changes, so it sorts and subtracts reliably, and you can convert to local time when displaying data.

What is the difference between a time zone and a UTC offset?
An offset is a fixed difference from UTC at one moment. A time zone is a named set of rules, including daylight saving, whose offset can change during the year.

Why do my daily totals differ between two dashboards?
They probably define the day in different time zones, so events near midnight land on different days. Agree on one business-day time zone and apply it everywhere.

Related posts

Leave a comment

Your email address will not be published. Required fields are marked *