Timezone conversion shifts TIMESTAMP or DATETIME values from one time zone to another or renders them in a desired zone for display.
Analytics often stores timestamps in UTC, but users expect local time.Converting on-the-fly keeps storage consistent while delivering location-aware reports.
Use FORMAT_TIMESTAMP for display, DATETIME(timestamp, timezone) to extract a local DATETIME, and TIMESTAMP(datetime, timezone) to re-cast that value into a new TIMESTAMP.
Wrap the TIMESTAMP
in FORMAT_TIMESTAMP
with the target IANA zone: FORMAT_TIMESTAMP('%F %T', order_date,'America/Los_Angeles')
.
1) Convert the source TIMESTAMP to a DATETIME in its original zone.
2) Re-cast that DATETIME to a TIMESTAMP in the target zone.
TIMESTAMP(DATETIME(order_date,'UTC'),'America/New_York') AS ny_time
Yes.Use the two-step DATETIME → TIMESTAMP
pattern. The resulting TIMESTAMP remains in UTC internally but reflects the target zone when formatted.
• Store timestamps in UTC.
• Keep a user_timezone field for each customer.
• Always reference official IANA names (e.g., "Europe/Paris").
• Avoid hard-coding offsets; daylight-saving changes break them.
See below.
.
No. TIMESTAMP values are stored as UTC microseconds since the Unix epoch. Time zone is applied only when formatting or re-casting.
Join to a user table that stores their IANA zone and pass that column as the third argument in FORMAT_TIMESTAMP or TIMESTAMP.