All Products
Search
Document Center

ApsaraDB RDS:ST_TimeZone

Last Updated:Mar 28, 2026

Returns the time zone of a point object.

Syntax

cstring ST_TimeZone(geometry point, boolean timezoneId, integer timezonePrecision);
cstring ST_TimeZone(geography point, boolean timezoneId, integer timezonePrecision);

Parameters

ParameterDescription
pointThe point object. Must meet both of the following requirements:
  • Data type: point
  • Spatial reference system: WGS84 (srid=4326)
timezoneIdSpecifies whether to return the time zone in name format. Valid values:
  • true (default): Returns the time zone name. Example: Asia/Shanghai.
  • false: Returns the time zone in GMT format. Example: Etc/GMT+8.
timezonePrecisionThe precision level for time zone lookup. Valid only when timezoneId is true. Valid values:
  • 16 (default): Precision of 0.0055 (~500m).
  • 21: Precision of 0.00017 (~20m).

Return value

Returns a cstring containing the time zone string.

Description

Looks up the time zone for a geographic point using boundary data from the Timezone Boundary Builder project.

image

Examples

Return the time zone name for a point (default behavior):

SELECT ST_TimeZone('SRID=4326;POINT(121 37)'::geometry);
----
Asia/Shanghai

SELECT ST_TimeZone('POINT(60 37)'::geography);
----
Asia/Tehran

Return the time zone in GMT format by setting timezoneId to false:

SELECT ST_TimeZone('SRID=4326;POINT(121 37)'::geometry, false);
----
Etc/GMT+8

Use higher precision (timezonePrecision=21) for a point near a time zone boundary:

SELECT ST_TimeZone('SRID=4326;POINT(-121 37)'::geometry, true, 21);
----
America/Los_Angeles

Pass a longitude value greater than 180°:

SELECT ST_TimeZone(('SRID=4326;POINT(400 37)'::geometry));
----
Europe/Istanbul