Timezone - Get Timezone By Coordinates

Use to get the current, historical, and future time zone information for the specified latitude-longitude pair.
The Get Timezone By Coordinates API is an HTTP GET request that returns current, historical, and future time zone information for a specified latitude-longitude pair. In addition, the API provides sunset and sunrise times for a given location, with the exception of regions that observe solar days.

GET {endpoint}/timezone/byCoordinates/json?api-version=1.0&query={query}
GET {endpoint}/timezone/byCoordinates/json?api-version=1.0&options={options}&timeStamp={timeStamp}&transitionsFrom={transitionsFrom}&transitionsYears={transitionsYears}&query={query}

URI Parameters

Name In Required Type Description
endpoint
path True

string

format
path True

JsonFormat

Desired format of the response. Only json format is supported.

api-version
query True

string

minLength: 1

The API version to use for this operation.

query
query True

number[]

Coordinates of the point for which time zone information is requested. This parameter is a list of coordinates, containing a pair of coordinate(lat, long). When this endpoint is called directly, coordinates are passed in as a single string containing coordinates, separated by commas.

options
query

TimezoneOptions

Alternatively, use alias "o". Options available for types of information returned in the result.

timeStamp
query

string (date-time)

Alternatively, use alias "stamp", or "s". Reference time, if omitted, the API will use the machine time serving the request.

transitionsFrom
query

string (date-time)

Alternatively, use alias "tf". The start date from which daylight savings time (DST) transitions are requested, only applies when "options" = all or "options" = transitions.

transitionsYears
query

integer (int32)

Alternatively, use alias "ty". The number of years from "transitionsFrom" for which DST transitions are requested, only applies when "options" = all or "options" = transitions.

Request Header

Name Required Type Description
x-ms-client-id

string

Indicates the account intended for use with the Microsoft Entra ID security model. This unique ID for the Azure Maps account can be obtained from the Azure Maps management plane Account API. For more information on using Microsoft Entra ID security in Azure Maps, see Manage authentication in Azure Maps.

Accept-Language

string

Specifies the language code in which the timezone names should be returned. If no language code is provided, the response will be in "EN". Please refer to Supported Languages for details.

Responses

Name Type Description
200 OK

TimezoneResult

The request has succeeded.

Other Status Codes

ErrorResponse

An unexpected error response.

Security

AadToken

These are the Microsoft Entra OAuth 2.0 Flows. When paired with Azure role-based access control it can be used to control access to Azure Maps REST APIs. Azure role-based access controls are used to designate access to one or more Azure Maps resource account or sub-resources. Any user, group, or service principal can be granted access via a built-in role or a custom role composed of one or more permissions to Azure Maps REST APIs.\n\nTo implement scenarios, we recommend viewing authentication concepts. In summary, this security definition provides a solution for modeling application(s) via objects capable of access control on specific APIs and scopes.\n\n#### Notes\n* This security definition requires the use of the x-ms-client-id header to indicate which Azure Maps resource the application is requesting access to. This can be acquired from the Maps management API.\n* \nThe Authorization URL is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Microsoft Entra ID configurations. \n* \nThe Azure role-based access control is configured from the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.\n* \nUsage of the Azure Maps Web SDK allows for configuration based setup of an application for multiple use cases.\n* For more information on Microsoft identity platform, see Microsoft identity platform overview.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
https://atlas.microsoft.com/.default

subscription-key

This is a shared key that is provisioned when you Create an Azure Maps account in the Azure portal or using PowerShell, CLI, Azure SDKs, or REST API.\n\n With this key, any application can access all REST API. In other words, this key can be used as a master key in the account that they are issued in.\n\n For publicly exposed applications, our recommendation is to use the confidential client applications approach to access Azure Maps REST APIs so your key can be securely stored.

Type: apiKey
In: header

SAS Token

This is a shared access signature token is created from the List SAS operation on the Azure Maps resource through the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.\n\n With this token, any application is authorized to access with Azure role-based access controls and fine-grain control to the expiration, rate, and region(s) of use for the particular token. In other words, the SAS Token can be used to allow applications to control access in a more secured way than the shared key.\n\n For publicly exposed applications, our recommendation is to configure a specific list of allowed origins on the Map account resource to limit rendering abuse and regularly renew the SAS Token.

Type: apiKey
In: header

Examples

Successfully retrieve timezone by coordinates

Sample request

GET {endpoint}/timezone/byCoordinates/json?api-version=1.0&options=all&query=47,-122

Sample response

{
  "referenceUtcTimestamp": "2019-06-17T22:16:59.0765556Z",
  "timeZones": [
    {
      "aliases": [
        "US/Pacific",
        "US/Pacific-New"
      ],
      "countries": [
        {
          "code": "US",
          "name": "United States"
        }
      ],
      "id": "America/Los_Angeles",
      "names": {
        "daylight": "Pacific Daylight Time",
        "generic": "Pacific Time",
        "iso6391LanguageCode": "en",
        "standard": "Pacific Standard Time"
      },
      "referenceTime": {
        "daylightSavings": "01:00:00",
        "posixTz": "PST+8PDT,M3.2.0,M11.1.0",
        "posixTzValidYear": 2019,
        "standardOffset": "-08:00:00",
        "sunrise": "2019-06-17T05:12:21.267-07:00",
        "sunset": "2019-06-17T21:05:18.017-07:00",
        "tag": "PDT",
        "wallTime": "2019-06-17T15:16:59.0765556-07:00"
      },
      "representativePoint": {
        "latitude": 34.05222222222222,
        "longitude": -118.24277777777777
      },
      "timeTransitions": [
        {
          "daylightSavings": "01:00:00",
          "standardOffset": "-08:00:00",
          "tag": "PDT",
          "utcEnd": "2019-11-03T09:00:00Z",
          "utcStart": "2019-03-10T10:00:00Z"
        },
        {
          "daylightSavings": "00:00:00",
          "standardOffset": "-08:00:00",
          "tag": "PST",
          "utcEnd": "2020-03-08T10:00:00Z",
          "utcStart": "2019-11-03T09:00:00Z"
        },
        {
          "daylightSavings": "01:00:00",
          "standardOffset": "-08:00:00",
          "tag": "PDT",
          "utcEnd": "2020-11-01T09:00:00Z",
          "utcStart": "2020-03-08T10:00:00Z"
        }
      ]
    }
  ],
  "version": "2019a"
}

Definitions

Name Description
CountryRecord

A country/region record.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

JsonFormat

Desired format of the response. Only json format is supported.

ReferenceTime

Details in effect at the local time.

RepresentativePoint

Representative point property

TimeTransition

Represents a time zone transition.

TimezoneId

Timezone ID information.

TimezoneNames

Timezone names object.

TimezoneOptions

Options for timezone information returned in the result.

TimezoneResult

This object is returned from a successful Timezone By ID call or By Coordinates call

CountryRecord

A country/region record.

Name Type Description
code

string

ISO-3166 2-letter country/region code for the country/region.

name

string

country/region Name

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).

Name Type Description
error

ErrorDetail

The error object.

JsonFormat

Desired format of the response. Only json format is supported.

Value Description
json

The JavaScript Object Notation Data Interchange Format

ReferenceTime

Details in effect at the local time.

Name Type Description
daylightSavings

string

Time saving in minutes in effect at the ReferenceUTCTimestamp.

posixTz

string

POSIX string used to set the time zone environment variable.

posixTzValidYear

integer (int32)

The year this POSIX string is valid for. Note: A POSIX string will only be valid in the given year.

standardOffset

string

UTC offset in effect at the ReferenceUTCTimestamp.

sunrise

string (date-time)

Sunrise at the given time zone as shown in the Tag property, populated only when the call is byCoordinates. The sunrise is described in the ISO 8601 format. Note that the Timezone API does not return sunrise and sunset times when solar day is observed in the requested region.

sunset

string (date-time)

Sunset at the given time zone as shown in the Tag property, populated only when the call is byCoordinates. The sunset is described in the ISO 8601 format. Note that the Timezone API does not return sunrise and sunset times when solar day is observed in the requested region.

tag

string

Time zone name in effect at the reference timestamp (i.e. PST or PDT depending whether Daylight Savings Time is in effect).

wallTime

string

Current wall time at the given time zone as shown in the Tag property.

RepresentativePoint

Representative point property

Name Type Description
latitude

number (float)

Latitude property

longitude

number (float)

Longitude property

TimeTransition

Represents a time zone transition.

Name Type Description
daylightSavings

string

DaylightSavings property

standardOffset

string

StandardOffset property

tag

string

Tag property

utcEnd

string (date-time)

End date, end time for this transition period

utcStart

string (date-time)

Start date, start time for this transition period

TimezoneId

Timezone ID information.

Name Type Description
aliases

string[]

An array of time zone ID aliases. Only returned when [options]=zoneinfo or all.

Note: may be null.

countries

CountryRecord[]

An array of country/region records. Only returned when [options]=zoneinfo or all.

id

string

Id property

names

TimezoneNames

Timezone names object.

referenceTime

ReferenceTime

Details in effect at the local time.

representativePoint

RepresentativePoint

Representative point property

timeTransitions

TimeTransition[]

Time zone DST transitions from [transitionsFrom] until timestamp + 1 year.

TimezoneNames

Timezone names object.

Name Type Description
daylight

string

Daylight Name

generic

string

Generic Name

iso6391LanguageCode

string

The ISO 639-1 language code of the Names

standard

string

Standard Name

TimezoneOptions

Options for timezone information returned in the result.

Value Description
none

Do not include zoneinfo or transitions in the result.

zoneInfo

Include additional time zone info in the result.

transitions

Include transition information in the result (The number of transitions is currently capped at 250).

all

Include both zoneinfo and transitions in the result.

TimezoneResult

This object is returned from a successful Timezone By ID call or By Coordinates call

Name Type Description
referenceUtcTimestamp

string (date-time)

Reference Utc Timestamp property

timeZones

TimezoneId[]

TimeZoneId array

version

string

Version property