Timezone - Get Timezone By Coordinates

Time Zone by Coordinates

Applies to: see pricing tiers.

This API 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.

GET https://atlas.microsoft.com/timezone/byCoordinates/json?api-version=1.0&query={query}
GET https://atlas.microsoft.com/timezone/byCoordinates/json?api-version=1.0&options={options}&timeStamp={timeStamp}&transitionsFrom={transitionsFrom}&transitionsYears={transitionsYears}&query={query}

URI Parameters

Name In Required Type Description
format
path True

JsonFormat

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

api-version
query True

string

Version number of Azure Maps API.

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

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

Specifies which account is intended for usage in conjunction with the Microsoft Entra ID security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Microsoft Entra ID security in Azure Maps see the following articles for guidance.

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

OK

Other Status Codes

ErrorResponse

An unexpected error occurred.

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.

To 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.

Notes

  • 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.

The Authorization URL is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Microsoft Entra ID configurations. * The Azure role-based access control is configured from the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs. * Usage of the Azure Maps Web SDK allows for configuration based setup of an application for multiple use cases.

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

Scopes

Name Description
https://atlas.microsoft.com/.default 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.

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.

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: query

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.

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.

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 https://atlas.microsoft.com/timezone/byCoordinates/json?api-version=1.0&options=all&query=47,-122

Sample Response

{
  "Version": "2019a",
  "ReferenceUtcTimestamp": "2019-06-17T22:16:59.0765556Z",
  "TimeZones": [
    {
      "Id": "America/Los_Angeles",
      "Aliases": [
        "US/Pacific",
        "US/Pacific-New"
      ],
      "Countries": [
        {
          "Name": "United States",
          "Code": "US"
        }
      ],
      "Names": {
        "ISO6391LanguageCode": "en",
        "Generic": "Pacific Time",
        "Standard": "Pacific Standard Time",
        "Daylight": "Pacific Daylight Time"
      },
      "ReferenceTime": {
        "Tag": "PDT",
        "StandardOffset": "-08:00:00",
        "DaylightSavings": "01:00:00",
        "WallTime": "2019-06-17T15:16:59.0765556-07:00",
        "PosixTzValidYear": 2019,
        "PosixTz": "PST+8PDT,M3.2.0,M11.1.0",
        "Sunrise": "2019-06-17T05:12:21.267-07:00",
        "Sunset": "2019-06-17T21:05:18.017-07:00"
      },
      "RepresentativePoint": {
        "Latitude": 34.05222222222222,
        "Longitude": -118.24277777777777
      },
      "TimeTransitions": [
        {
          "Tag": "PDT",
          "StandardOffset": "-08:00:00",
          "DaylightSavings": "01:00:00",
          "UtcStart": "2019-03-10T10:00:00Z",
          "UtcEnd": "2019-11-03T09:00:00Z"
        },
        {
          "Tag": "PST",
          "StandardOffset": "-08:00:00",
          "DaylightSavings": "00:00:00",
          "UtcStart": "2019-11-03T09:00:00Z",
          "UtcEnd": "2020-03-08T10:00:00Z"
        },
        {
          "Tag": "PDT",
          "StandardOffset": "-08:00:00",
          "DaylightSavings": "01:00:00",
          "UtcStart": "2020-03-08T10:00:00Z",
          "UtcEnd": "2020-11-01T09:00:00Z"
        }
      ]
    }
  ]
}

Definitions

Name Description
CountryRecord

A country/region record.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

JsonFormat

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

ReferenceTime

Details in effect at the local time.

RepresentativePoint

Representative point property

TimeTransition
TimezoneId
TimezoneNames

Timezone names object.

TimezoneOptions

Alternatively, use alias "o". Options available for types of 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

Error response

Name Type Description
error

ErrorDetail

The error object.

JsonFormat

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

Name Type Description
json

string

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

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

Sunrise at the given time zone as shown in the Tag property. The sunrise is described in the ISO8601 format. (Only be populated if the call is byCoordinates)

Sunset

string

Sunset at the given time zone as shown in the Tag property. The sunset is described in the ISO8601 format.(Only be populated if the call is byCoordinates)

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

Latitude property

Longitude

number

Longitude property

TimeTransition

Name Type Description
DaylightSavings

string

DaylightSavings property

StandardOffset

string

StandardOffset property

Tag

string

Tag property

UtcEnd

string

End date, end time for this transition period

UtcStart

string

Start date, start time for this transition period

TimezoneId

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

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

Name Type Description
all

string

Include both zoneinfo and transitions in the result.

none

string

Do not include zoneinfo or transitions in the result.

transitions

string

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

zoneInfo

string

Include additional time zone info in the result.

TimezoneResult

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

Name Type Description
ReferenceUtcTimestamp

string

Reference Utc Timestamp property

TimeZones

TimezoneId[]

TimeZoneId array

Version

string

Version property