Document Web Service Guides Time Zone

Time Zone

The Time Zone API is a straightforward service. Provide a location and a time (historical, current, or future), and it returns the time zone information for that location, including the time zone ID, UTC standard time or local time, the offset from UTC standard time, and the daylight saving time (DST) offset.

Use Cases

  • Scheduling across time zones: A user in Tokyo and a colleague in New York need to schedule a meeting for the next day. The API helps determine the local time on both sides to coordinate the timing.
  • Real-time global clocks: A developer is building a website or application that needs to display the current time in different cities in real time.

Before You Begin

1
Step 1
Apply for a 【Web Service API】 Key
2
Step 2
Enable overseas access for the applied Key by submitting a ticket to request the required permissions
3
Step 3
Construct the HTTP request URL, including the Key obtained in Step 1 as a required parameter
4
Step 4
Receive and parse the data returned from the HTTP request (in JSON or XML format)
Unless otherwise specified, all input parameters and output data are encoded in UTF-8.

Time Zone

Time Zone API Service URL

URL

https://sg-restapi.opnavi.com/v5/timezone 

Request Method

GET

All parameters are separated by the ampersand character (&). The following table lists the available parameters.

Request Parameters

Name

Meaning

Rule Description

Required

Default

key

Service authorization token

Apply for a Web Service API Key and submit a work order for overseas permissions on the Amap Map official website.

Yes

None

location

Location

Longitude and latitude separated by a comma (,), with longitude first and latitude second. The number of decimal places must not exceed 6. Only one location is allowed.

Yes

None

time_type

Time type

1 - UTC standard time

2 - Local time (supports dates after January 1, 1970)

No

1

time

Time

When time_type is 1, the value is a timestamp in seconds.

When time_type is 2, the value is a date and time in the format YYYY-MM-DDThh:mm:ss. For example: 2025-09-01T10:00:00. This can be a past or future time.

Yes

None

Examples

Get UTC Standard Time Based on Local Time

https://sg-restapi.opnavi.com/v5/timezone?location=-57.31786,-24.89475&time_type=2&time=2025-09-01T10:00:00&key=<YOUR_API_KEY>

Get Local Time Based on UTC Standard Time

https://sg-restapi.opnavi.com/v5/timezone?location=139.755957,35.684122&time_type=1&time=1756731600&key=<YOUR_API_KEY>

Response Parameters

Name

Description

Specification

status

Return result status value

0: Request failed

1: Request succeeded

info

Return status description

When status is 0, info returns the reason for the error. Otherwise, it returns 'OK'. For details, refer to the info status table.

infocode

Return status code

For details, refer to the infocode in the info status table.

time_zone_id

Time zone ID

For example: America/Asuncion

time

Time

When the input is local time, this represents UTC standard time. When the input is UTC standard time, this represents local time.

rawoffset

Offset from Coordinated Universal Time (UTC)

Unit: seconds

dstoffset

Daylight saving time offset

Unit: seconds