TZ_OFFSET
Updated at:
Copy as MD
TZ_OFFSET returns the time zone offset of a specified time zone relative to Greenwich Mean Time (GMT).
Syntax
TZ_OFFSET(n)Parameters
| Parameter | Description |
|---|---|
n | The name of the time zone whose offset you want to retrieve. |
To list all valid time zone region names, run:
SELECT * FROM pg_timezone_names;Examples
Query a positive offset
SELECT TZ_OFFSET('Antarctica/Syowa');Output:
tz_offset
-----------
+03:00
(1 row)Antarctica/Syowa is 3 hours ahead of GMT.
Query a negative offset
SELECT TZ_OFFSET('US/Eastern');Output (standard time):
tz_offset
-----------
-05:00
(1 row)US/Eastern is 5 hours behind GMT during standard time.
Is this page helpful?