In this article, We learn how to convert UTC to PST with daylight saving using bing maps API. I will show you how and just follow the steps clearly.

For more updates please do Subscribe via Email:

Convert UTC Datetime to Different Time Zone with daylight saving using Bing maps API
Convert UTC Datetime to Different Time Zone with daylight saving using Bing maps API

What is UTC or PST?

UTC and PST is time zone with different setting time. UTC means Coordinated Universal Time or Universal Time Coordinated (UTC). And PST is Pacific Standard Time different from the UTC. actually there is many more time zone with different offset time. UTC has a 00:00 offset and PST has a -08:00 offset. Its means that PST is delayed eight hours from the UTC time zone.

UTC to PST - Online Converter

What is Daylight saving?

Daylight saving time, also known as daylight savings time or daylight time, and summer time, is the practice of advancing clocks during warmer months so that darkness falls at a later clock time. Some time zone has daylight saving time that they are adjusting there time one hour backward from the original time and reset it after several months. for year 2022 the day light saving start from March 13 to November 6. The main purpose of this is to make better use of daylight or the sun light shine for the particular places.

The Tumultuous History of Daylight Saving Time | OpenMind

Bing maps?

Bing maps is a web mapping service provided as part of Microsoft Bing suite of search engines. Currently, Bing Maps provides maps & level wise layouts of over 5300 venues across the world.

Bing maps API

Convert UTC Datetime to a Different Time Zone

Converts a datetime value in UTC format to local time in the specified time zone. The date component is used to determine the correct day light saving settings.

https://dev.virtualearth.net/REST/v1/TimeZone/Convert/?datetime={datetime_utc}&desttz={timezoneid}&key={BingMapsKey}

API Parameters

ParametersAliasDescriptionsValues
dateTimedtRequired. The UTC date time string for the specified location. The date must be specified to apply the correct DST.The date time string must be in UTC format. If the date is not included, the returned time zone information may be incorrect.

Example2018-05-15T13:14:15Z
desttzRequired. The ID of the destination time zone.

The value of datetime will be converted to the local time of this time zone.
Any valid IANA or Windows time zone name.

Examples:

– Americas/LosAngeles
– Cape Verde Standard Time
includeDstRulesOptional. If set to true then DST rule information will be returned in the response.

Note: For information about DST rules, see the DSTRule Resource.
Either true or false.

Default: false
outputoOptional. Output format of the response.Format of the response:

– JSON
– XML

Default: JSON

Create Bing Maps Key

One of the required parameter is the value of key which is the BingMapsKey. In order to generate that key you need to visit this link and sign-in.

First create a account details under the my account tab.

Next create a key by navigating it in My keys under the my account tab. Filled up the necessary fields to create the Bing Maps Key.

This is the case when you are created the key details. You can copy the key directly via hitting the button copy key and enable a visibility of the key by hitting the Show key link button.

Output

I try to execute the API using postman software.

Output response

{
    "authenticationResultCode": "ValidCredentials",
    "brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
    "copyright": "Copyright © 2022 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
    "resourceSets": [
        {
            "estimatedTotal": 1,
            "resources": [
                {
                    "__type": "RESTTimeZone:http://schemas.microsoft.com/search/local/ws/rest/v1",
                    "timeZone": {
                        "genericName": "Pacific Standard Time",
                        "abbreviation": "PST",
                        "ianaTimeZoneId": "America/Los_Angeles",
                        "windowsTimeZoneId": "Pacific Standard Time",
                        "utcOffset": "-8:00",
                        "convertedTime": {
                            "localTime": "2022-06-14T18:30:30",
                            "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",
                            "dstAdjust2": "0"
                        }
                    }
                }
            ]
        }
    ],
    "statusCode": 200,
    "statusDescription": "OK",
    "traceId": "d284d20d0ddfad6|PUS0004C6E|0.0.0.1"
}

Happy Learning..

Thank you for visiting my blog site. Hoping you learn more here. please feel free to comment and suggest if there is need to enhance and update. thank you.

Related Topics

One Reply to “Convert UTC Datetime to Different Time Zone with daylight saving using Bing maps API”

Leave a Reply

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