All Products
Search
Document Center

PolarDB:TZ_OFFSET

Last Updated:Sep 04, 2024

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:

select * from pg_timezone_names;

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:

     ---The following query result shows the time zone offset of the US/Eastern time zone in winter time.
     tz_offset 
    -----------
     -05:00
    (1 row)