cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Microsoft
Microsoft

Re: Get time for a city

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
Highlighted
Super User
Super User

Re: Get time for a city

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

Highlighted
Microsoft
Microsoft

Re: Get time for a city

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (5,773)