UTC_TO_LOCAL()
All functions > DATE AND TIME > UTC_TO_LOCAL()
Interprets a naive UTC TIMESTAMP as an instant and returns it in the given timezone (TIMESTAMPTZ).
Signatures
Returns: The same instant expressed with the target zone
UTC_TO_LOCAL(timestamp: TIMESTAMP, timezone: VARCHAR) → TIMESTAMPTZ sql
| Parameter | Type | Required | Description |
|---|---|---|---|
timestamp | TIMESTAMP | Yes | Naive TIMESTAMP whose fields are UTC wall time |
timezone | VARCHAR | Yes | Target IANA timezone name ('Europe/Paris') or fixed-offset name ('Etc/GMT-2' for UTC+2; sign is POSIX-inverted) |
Notes
- The first argument must be a naive TIMESTAMP (not TIMESTAMPTZ); its fields are read as UTC.
- Accepts IANA timezone names ('Europe/Paris', 'America/New_York') or fixed-offset names ('Etc/GMT-2' for UTC+2, 'Etc/GMT+5' for UTC-5)
- Note: the sign in 'Etc/GMT±N' is POSIX-inverted — 'Etc/GMT-2' means UTC+2
- The return type is TIMESTAMPTZ(3)
- Propagates NULL: if the input is NULL the result is NULL
- Inverse direction (local wall time → UTC naive storage) uses LOCAL_TO_UTC()
Examples
FeatureQL
SELECT
f1 := UTC_TO_LOCAL(TIMESTAMP '2024-03-15 09:50:00', 'Europe/Paris'), -- UTC to Paris (CET, UTC+1 in March)
f2 := UTC_TO_LOCAL(TIMESTAMP '2024-03-15 09:50:00', 'America/New_York'), -- UTC to New York (EDT, UTC-4 in March)
f3 := UTC_TO_LOCAL(NULL(TIMESTAMP), 'Europe/Paris') -- NULL propagates
;Result
| f1 TIMESTAMP | f2 TIMESTAMP | f3 TIMESTAMP |
|---|---|---|
| 2024-03-15T10:50:00 | 2024-03-15T05:50:00 | NULL |
On this page