The TZ_OFFSET function returns the time zone offset of a specified time zone.
Note The time zone offset refers to the difference between the current time zone and Greenwich
Mean Time (GMT).
Syntax
TZ_OFFSET (n)
Parameters
Parameter | Description |
---|---|
n | The name of the time zone whose offset you want to retrieve. You can execute the following
statement to retrieve the name of the time zone from the pg_timezone_names view:
|
Examples
-
Execute the following statement to query the time zone offset of the
Antarctica/Syowa
time zone:SELECT TZ_OFFSET('Antarctica/Syowa');
In the following query result,
Antarctica/Syowa
is 3 hours ahead of GMT:tz_offset ----------- +03:00 (1 row)
-
Execute the following statement to query the time zone offset of the
US/Eastern
time zone:SELECT TZ_OFFSET('US/Eastern');
In the following query result,
US/Eastern
is 5 hours behind GMT:tz_offset ----------- -05:00 (1 row)