Scalar function
With valid constant timezone names, NULL timestamp yields NULL. NULL timezone literals yield NULL through the generic branch. Invalid constant timezone names error; the constants may be parsed before NULL timestamp handling.
Syntax
Instant (scalar)
Wallclock (scalar)
Arguments
Instant
Wallclock
Returns
- Type: TIMESTAMP: timezone-bearing for two arguments, timezone-free for three arguments.
- NULL behavior: With valid constant timezone names, NULL timestamp yields NULL. NULL timezone literals yield NULL through the generic branch. Invalid constant timezone names error; the constants may be parsed before NULL timestamp handling.
Properties
Usage notes
- The two-argument form sets the target time zone while preserving the same instant.
- The three-argument form converts a local time from the source time zone to the target time zone and returns a TIMESTAMP without a time zone.
- In the three-argument form, a local time that occurs twice during a clock change selects the earlier instant. A local time skipped by a clock change uses the offset after the change.
- With two arguments, the instant stays the same and the result uses the target time zone. With three arguments, the source local time is converted to the target local time and returned without a time zone. Time-zone arguments must be constant.
- In the three-argument form, a local time repeated by a clock change selects the earlier instant. For a skipped local time, conversion tries the offset one hour later and raises an error if the time still cannot be resolved.
Examples
Convert fixed source wall clock
A time-zone change can change the date
Limitations
- Three-argument conversion reconstructs negative fractional epochs using division toward zero and an absolute remainder; that input extension is excluded.
- Use a constant target time zone. A time-zone column can change both the displayed clock time and the result’s time-zone information, so it is outside these forms.
Last modified on October 15, 2026