***Updated July 15, 2022***
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, as working with time zones can easily get complicated for developers, this called for an API that could convert time zones quickly, and with a high degree of accuracy.
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. These APIs are designed to make it easy for developers to work with time zones using timezone IDs and geolocation. Both Windows and IANA standards are supported. This API covers most of the scenarios that developers must deal with when working with time zones.
Time Zone Chart
Given a place name, find the time zone of the place
Most time zone APIs available today require latitude, longitude as input. This typically calls for 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 geolocation solution for converting timezones that enables developers to work directly with timezone IDs and physical location names and addresses.
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. This API feature can also be used for time zone converting applications due to the inclusion of the ‘utcOffset’ value.
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” } } |
Geocoding with Bing Maps API
Bing Maps API’s geocoding and reverse geocoding features provide the foundation for the interoperability between coordinates and location names. Time Zone API’s support for multiple timezone IDs is accompanied by an extensive array of developer-friendly geolocation tools.
Along with sending requests for time zones for a single location, developers can quickly retrieve point data for multiple locations and vice versa using batch geocoding support. This data can then be used for fast time zone conversions with our new API. Head over to our documentation to learn more about geocoding with the location data API.
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.
https://dev.virtualearth.net/REST/v1/timezone/convert/?datetime=2018-05-15T13:14:15Z&desttz=china/Beijing&o=xml&includeDstRules=true&key={BingMapsKey}
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
Along with functioning as a time zone converter, the API can also provide comprehensive information for a range of time zones. Given a geolocation timezone 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
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
Along with functioning as a time zone converter, the API can also provide comprehensive information for a range of time zones. Given a geolocation timezone 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” } } |
Build Apps With Time Zone API
Even the most versatile APIs are only as good as their best applications. The Bing Maps API team has ensured that developers, whether they’re enthusiasts or experts, can quickly grasp the ins-and-outs of the Time Zone API. Building an app that takes advantage of this feature is as easy as checking out the documentation and jumping in.
Whether you’re just looking for a time zone converter API, or building a mapping app with geolocation and timezone IDs, the Time Zone API is the efficient way to do it. Get started within seconds with a free Bing Maps API key.
– Bing Maps Team
Frequently Asked Questions (FAQs)
What data formats does the Time Zone API support?
The API will return responses either in XML or JSON. Resources like convertedTime and DstRule can also optionally be included in responses for further clarity. To learn more about resources and time zone converter API data, visit our data documentation.
Where can I find a detailed list of the supported time zones?
The Time Zone API supports a list function, providing a detailed response containing a comprehensive list of time zone IDs.https://dev.virtualearth.net/REST/V1/TimeZone/List/?timezonestandard=windows&key={BingMapsKey}
Depending on the parameter used, this URL will return a list for either the IANA or Windows standard. Consult our list documentation for more information and examples.
Does the API account for Daylight Savings Time (DST)?
Aside from geolocation and timezone IDs, Bing Maps API also takes DST into account through the DstRule resource. Time Zone API responses will include DST data if the DST rules are available for a given time zone ID. The API’s in-built support for DST also makes time zone conversions simpler