cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ezequiel
Microsoft
Microsoft

Get time for a city

Hi

 

Similar as the Weather connector, Is there any connector to get time on a certain city if someone input the name of the city as a trigger?

 

Thanks

 

Ezequiel

 

1 ACCEPTED SOLUTION

Accepted Solutions
rohentz
Community Support
Community Support

Hi @ezequiel how are you?

 

@ezequiel unfurtunately we do not have yet an action to do that, but I think you can use a combination using Bing Maps connector and also the Bing Maps API in a HTTP request.

 

Using the Bing Maps connector you can use the "Get location by address" action https://docs.microsoft.com/en-us/connectors/bingmaps/#get-location-by-address . This will return the point of the location on the map.

 

After that you can use the Bing Maps API calling the timezone service to get the current time as descibed on https://docs.microsoft.com/en-us/bingmaps/rest-services/timezone/find-time-zone#return-time-zone-inf... passing the location point 

 

Do not forget to create first a Bing Maps Key for that at https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-m...

 

My sample here was a manually trigger flow adding the city and country.

 

Full sampleFull sample

 

At the Parse JSON action, you can add this to generate the object clicking on "Generate from sample" button. This is the body of the output of the HTTP action.

 

{
"authenticationResultCode": "ValidCredentials",
"brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
"copyright": "Copyright © 2020 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": "Romance Standard Time",
"abbreviation": "CET",
"ianaTimeZoneId": "Europe/Paris",
"windowsTimeZoneId": "Romance Standard Time",
"utcOffset": "1:00",
"convertedTime": {
"localTime": "2020-07-09T19:02:33",
"utcOffsetWithDst": "2:00",
"timeZoneDisplayName": "Romance Daylight Time",
"timeZoneDisplayAbbr": "CEST"
}
}
}
]
}
],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "0b124377cdb0400e8c0465d8a99d21e4|CH000010A4|0.0.0.1"
}

 

This is the formula used to get the value on the Notification action

 

body('Parse_JSON')['resourceSets'][0]['resources'][0]['timeZone']['convertedTime']['localTime'
 
I hope that this can help you on your question.
 
Regards.
 
Rodrigo Hentz
Microsoft Support Engineer

View solution in original post

2 REPLIES 2
Rahber
Solution Sage
Solution Sage

Nop. But you can use the HTTP Api to get the time from any other API such as http://worldtimeapi.org/

 

Please click Accept as Solution if it resolved your problem or give it a Thumbs Up if it helped you in anyway this will allow other people to search correct solutions effectively.

Thanks,

Rahber

rohentz
Community Support
Community Support

Hi @ezequiel how are you?

 

@ezequiel unfurtunately we do not have yet an action to do that, but I think you can use a combination using Bing Maps connector and also the Bing Maps API in a HTTP request.

 

Using the Bing Maps connector you can use the "Get location by address" action https://docs.microsoft.com/en-us/connectors/bingmaps/#get-location-by-address . This will return the point of the location on the map.

 

After that you can use the Bing Maps API calling the timezone service to get the current time as descibed on https://docs.microsoft.com/en-us/bingmaps/rest-services/timezone/find-time-zone#return-time-zone-inf... passing the location point 

 

Do not forget to create first a Bing Maps Key for that at https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-m...

 

My sample here was a manually trigger flow adding the city and country.

 

Full sampleFull sample

 

At the Parse JSON action, you can add this to generate the object clicking on "Generate from sample" button. This is the body of the output of the HTTP action.

 

{
"authenticationResultCode": "ValidCredentials",
"brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
"copyright": "Copyright © 2020 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": "Romance Standard Time",
"abbreviation": "CET",
"ianaTimeZoneId": "Europe/Paris",
"windowsTimeZoneId": "Romance Standard Time",
"utcOffset": "1:00",
"convertedTime": {
"localTime": "2020-07-09T19:02:33",
"utcOffsetWithDst": "2:00",
"timeZoneDisplayName": "Romance Daylight Time",
"timeZoneDisplayAbbr": "CEST"
}
}
}
]
}
],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "0b124377cdb0400e8c0465d8a99d21e4|CH000010A4|0.0.0.1"
}

 

This is the formula used to get the value on the Notification action

 

body('Parse_JSON')['resourceSets'][0]['resources'][0]['timeZone']['convertedTime']['localTime'
 
I hope that this can help you on your question.
 
Regards.
 
Rodrigo Hentz
Microsoft Support Engineer

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,203)