name: time-zones
description: Time zones end to end — which zone a request uses, how a datetime buckets by local calendar day, import in a source zone with DST policy, native timestamps, local-offset export and the tz database version. Topical design.
type: guide
kind: design
applies_to: process, compose, predict, inspect
covers: [time_zone, tz, tz_field, time_zone_field, datetime, week_start, hour, source_tz, source_tz_field, dst_policy]
Time zones
Storage is always UTC. datetime = epoch SECONDS, date = epoch DAYS (never interchangeable). A zone only changes how an instant is READ (calendar day, wall clock) or RENDERED (export). Names are UTC or an exact IANA Area/Location from Pulse’s own embedded tz database (never the host’s); EST, Local, +05:00, "" fail PULSE_TIMEZONE_UNKNOWN. The manifest carries the release as tzdata_version; a slot-level zone key marks which operators take a zone (capable) or follow their host (following).
Which zone applies
Per slot: slot tz -> slot tz_field -> request time_zone_field -> request time_zone -> cohort zone_field -> Options.DefaultTimeZone -> UTC. Predict resolves the same way and echoes time_zones[] (slot, tz, tz_field, source = slot|field|request|cohort|options|default). tz on a date field, or on an operator that is not zone-capable, is PROCESSING_CONFIG. An inherited zone on a date field is not applied (tz: null). A non-UTC zone on a derived field (absent from the schema) is refused.
UTC, Etc/UTC and absent give identical output.
Per-row zones
When each record has its own zone, name a categorical_* field of IANA names: slot tz_field on groups / filterers / attributes / features (and crosstab axes), or request-wide time_zone_field on Request / FacetRequest. tz + tz_field on one slot is PROCESSING_CONFIG; so is a zone field that is not categorical_*, one on a non-capable operator, or an explicit tz_field on a date field. Predict checks every dictionary entry (PULSE_TIMEZONE_UNKNOWN, details.dictionary_index), as the run does. Echo: tz: null, source: "field".
A cohort can store its own default zone field in its schema (zone_field, the .pulse ZONE section): it must be a categorical_* field whose every dictionary entry is a valid zone, the same rule as time_zone_field, checked on write and read (ENCODING_INVALID for a missing or non-categorical field, PULSE_TIMEZONE_UNKNOWN for a bad entry). Such a cohort is format 0x02 (older builds refuse it). pulse cohort inspect / pulse_inspect show it as zone_field.
It is inherited like time_zone_field, below any request zone (echo source: "cohort", tz_field, tz: null): skipped on a date field, refused on a derived field (override: request time_zone, e.g. UTC). A join takes the LEFT cohort’s default, never the right’s. A chain stage 1+ takes NO per-row zone, permanently: no datetime survives a stage, so its time_zone_field / tz_field is SERVICE_VALIDATION.
A NULL zone cell (or an out-of-dictionary code) gives the row NO local value, never a UTC fallback: groupers count it in n_null (no bucket).
ATTR_DATE_PART / FEAT_DATE_FEATURES output null for it.
FILTER_DATE_RANGES drops it and counts it in n_null_input.
OVERLAY_YOY follows its host’s keys.
Expressions (to_day, weekday) stay request-zone only (time_zone), never per-row: filter per row through a derived date feature plus a filter.
Stored instants
A datetime stores whole seconds since the epoch, naive UTC. Synthetic ones: op-synth-uniform-datetime (local time, fixed or per-row zone, DST per dst_policy); profile create reads them on zone_field (synth-datetime). A fraction floors toward the past (native Arrow / Parquet timestamps warn PULSE_IMPORT_TIMESTAMP_TRUNCATED); keep microseconds in a u64. An offset-bearing literal is normalised to the same instant and the offset discarded (…T10:11:12+02:00 → …T08:11:12Z); export --tz renders it back with a local offset. Truncating to a day floors toward the past (1969-12-31T23:59:59Z is day −1 in UTC).
Local-day semantics
A datetime is read on its LOCAL calendar day in every mode (process, stream, compose, parallel, shards, crosstab, join, chain, facet); a Berlin request’s days are Berlin calendar days, DST changes included. Say so: “days are Berlin calendar days”.
GROUP_DATEkeys are local labels.component: hourkeysYYYY-MM-DDTHH(hour_of_day:HH) local wall clock (datetime only; the skipped DST hour has no bucket, the repeated hour is one bucket).week_start(week only) defaults tomonday(ISOYYYY-Www); any other day keys by the week’s first local date.- Range literals are LOCAL calendar days in the slot’s zone.
RangeTablescarry no zone: the slot’s zone applies.- Filter-to-file zones
FILTER_DATE_RANGESlikeProcess; the zone keys the output name. ATTR_DATE_PARTandFEAT_DATE_FEATURESacceptdatetimeand read the zone’s wall clock; parthour(and the<label>_hourfeature column) is datetime-only.iso_weekday/doware ISO (Monday = 1), ignoringweek_start.- Formulas and expression filters:
to_day(ts)reads the inherited zone (requesttime_zone->Options.DefaultTimeZone-> UTC) on every entry point (filter-to-file:FilterToFileRequest.TimeZone); they take no slottz(calendar-formulas). OVERLAY_YOYhas no zone slot; it follows its host grouper, so an hourly host gives hourly prior-year alignment.
Import in a source zone
A naive literal (no Z, no offset) imports as UTC unless the import names a source zone — per file, per column or per row (source_tz_field); a DST gap or overlap is fatal unless dst_policy resolves it; zoned Arrow / UTC-adjusted Parquet timestamps never move. Every rule and code: import-source-zones.
Export in a zone
export --tz Zone renders each datetime with its local offset (2024-03-10T08:00:00+05:30); the stored instant is unchanged. Default: UTC Z. convert has no --tz.
SPSS export refuses a non-UTC --tz (PULSE_SPSS_EXPORT_UNSUPPORTED).
Gotchas
- A DST day has 23 or 25 hours; local-day counts differ from UTC-day counts only for records near midnight.
See
import-source-zones, grouper-design, calendar-formulas, type-datetime, type-date, request-envelope, session-format-flags, overlay-system.