Bing Maps Time Zone API: An easier way to work with time zones

The Microsoft Windows Time Zone standard and the IANA time zone standard provide a well-defined structure for representing time zones used across the world. However, time zones change more frequently than expected. A country or administrative region may change the time zone they are using. Other regions change the way they apply daylight saving time. Not surprisingly, working with time zones can easily get complicated for developers.

Bing Maps is pleased to announce the general availability of our new Time Zone API. The Bing Maps Time Zone API is a collection of five easy-to-use REST APIs that are designed to make it easy for developers to work with time zones. Both Windows and IANA standards are supported. The API will cover most of the scenarios that developers must deal with when working with time zones.

Given a place name, find the time zone of the place

Most time zone APIs available today require latitude, longitude as input. This typically requires an additional step for developers to obtain the geographical coordinates of a place before being able to obtain the time zone information. Instead, the Bing Maps Time Zone API provides a one-stop solution enabling developers to work directly with their locations. Given a place name e.g. “Seattle, WA” or “Taipei” the Bing Maps Time Zone API will return time zone information of that location. If the given location has multiple time zones all of them are returned as a list.

https://dev.virtualearth.net/REST/v1/TimeZone/query=taipei?key=<bingmaps-key>

Output

"timeZone": {

            "genericName": "Taipei Standard Time",

            "abbreviation": "CST",

            "ianaTimeZoneId": "Asia/Taipei",

            "windowsTimeZoneId": "Taipei Standard Time",

            "utcOffset": "8:00",

            "convertedTime": {

              "LocalTime": "2018-07-29T11:26:26",

              "UtcOffsetWithDst": "8:00",

              "TimeZoneDisplayName": "Taipei Standard Time",

              "timeZoneDisplayAbbr": "CST"

            }

          }

Given location coordinates, find the time zone of the place

For the cases where latitude, longitude information is already available, the Bing Maps Time Zone API will return the time zone information for the corresponding location.

https://dev.virtualearth.net/REST/v1/TimeZone/17.430350, 78.342099?key=<bingmaps-key>

Output

"timeZone": {

            "genericName": "India Standard Time",

            "abbreviation": "IST",

            "ianaTimeZoneId": "Asia/Kolkata",

            "windowsTimeZoneId": "India Standard Time",

            "utcOffset": "5:30",

            "convertedTime": {

              "LocalTime": "2018-07-29T08:54:13",

              "UtcOffsetWithDst": "5:30",

              "TimeZoneDisplayName": "India Standard Time",

              "timeZoneDisplayAbbr": "IST"

            }

          }

Find local time at a given location

Given a time value in UTC format and a target time zone, the Bing Maps Time Zone API will return the local time in the target time zone. DST setting is automatically applied based on time of the year.

http://dev.virtualearth.net//REST/v1/TimeZone/Convert/?datetime=10:14:15Z&targettimezoneid=Pacific Standard Time&o=xml&key=<bingmaps-key>

Output

<TimeZone>

      <GenericName>China Standard Time</GenericName>

      <Abbreviation>CST</Abbreviation>

      <WindowsTimeZoneId>China Standard Time</WindowsTimeZoneId>

      <UTCOffset>8:00</UTCOffset>

      <ConvertedTime>

            <LocalTime>2018-08-08T18:14:15</LocalTime>

            <UtcOffsetWithDst>8:00</UtcOffsetWithDst>

            <TimeZoneDisplayName>China Standard Time</TimeZoneDisplayName>

            <TimeZoneDisplayAbbr>CST</TimeZoneDisplayAbbr>

      </ConvertedTime>

</TimeZone>

Obtain list of time zones in Windows and IANA standard

The Bing Maps Time Zone API can return a list of time zones per Windows and IANA standards. This list can be used as a data source for time zone selection UX elements in web applications.

http://dev.virtualearth.net/REST/V1/TimeZone/List/?timezonestandard=Windows&key=<bingmaps-key>

Output

List of 128 Windows time zones (not listed here for brevity)

Obtain complete information about a time zone

Given a time zone id per Windows or IANA standards, the Bing Maps Time Zone API will return complete information about the time zone including time zone names, UTC offsets, abbreviation and DST offset with start and end dates.

https://dev.virtualearth.net/REST/V1/TimeZone/?targettimezoneid=America/los_angeles&key=<bingmaps-key>

Output

"timeZone": {

            "genericName": "Pacific Standard Time",

            "abbreviation": "PST",

            "ianaTimeZoneId": "America/Los_Angeles",

            "windowsTimeZoneId": "Pacific Standard Time",

            "utcOffset": "-8:00",

            "convertedTime": {

              "LocalTime": "2018-08-08T10:53:59",

              "UtcOffsetWithDst": "-7:00",

              "TimeZoneDisplayName": "Pacific Daylight Time",

              "timeZoneDisplayAbbr": "PDT"

            },

            "dstRule": {

              "dstStartMonth": "Mar",

              "dstStartDateRule": "Sun>=8",

              "dstStartTime": "2:00",

              "dstAdjust1": "1:00",

              "dstEndMonth": "Nov",

              "dstEndDateRule": "Sun>=1",

              "dstEndTime ": "2:00"

            }

          }

The Bing Maps Time Zone API is available for use with your existing Bing Maps key. It supports JSON and XML formats for return values. To learn more, refer to the complete documentation on MSDN.

– Bing Maps Team

Source: Bing Blog Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.