Here is how you can call the time zone API from JavaScript:
var bingMapsKey = 'Your Bing Maps Key';
function getTimeZoneInfo(query){
//Encode query as special characters in some addresses can cause issues.
var query = `https://dev.virtualearth.net/REST/v1/timezone/?q=${encodeURIComponent(query)}&key=${bingMapsKey}`;
fetch(query).then(r => r.json()).then(r => {
if(r && r.resourceSets && r.resourceSets.length > 0 && r.resourceSets[0].resources &&
r.resourceSets[0].resources.length > 0 && r.resourceSets[0].resources[0] &&
r.resourceSets[0].resources[0].timeZoneAtLocation &&
r.resourceSets[0].resources[0].timeZoneAtLocation.length > 0) {
var result = r.resourceSets[0].resources[0].timeZoneAtLocation[0];
var timez = result.timeZone[0].convertedTime.localTime;
var timezone = result.timeZone[0].convertedTime.timeZoneDisplayName;
var formattedTime = new Date(Date.parse(timez)).toTimeString();
console.log(`Local time: ${formattedTime}`);
//Optionally, get the local time without GMT offset and timezone name.
formattedTime = formattedTime.substr(0, formattedTime.indexOf(' GMT-'));
console.log(`Local time: ${formattedTime} ${timezone}`);
} else {
console.log('Unable to find timezone for location');
}
});
}