cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
krishnags
Super User
Super User

Get current user's timezone

Dear all, is there any way to get the canvas app accessing user's timezone. Based on that I want  to convert some static time slots int to their timezone.

 

In my app, user can select time slots (9 AM, 10 AM, 11 AM, 7 PM, 8 PM) with a date picker provided to them and they can select that at their choice, but as I couldn't find a way I used a label on the slots that all those are in GMT time zone.

 

If there is a way to get user's timezone I can make use of MS flow to convert the time. This cannot be done directly in the app, as I am using static time slots as shown.

 

Please provide your suggestions on this...

 

Thank You,

Sai Krishna.

1 ACCEPTED SOLUTION

Accepted Solutions

You can calculate that based on the value of the time zone offset. This expression should give you what you need:

"UTC"
    & If(TimeZoneOffset() > 0, "-", "+")
    & RoundDown(Abs(TimeZoneOffset()) / 60, 0)
    & ":"
    & If(Mod(Abs(TimeZoneOffset()), 60) < 10, "0", "")
    & Mod(Abs(TimeZoneOffset()), 60)

Hope this helps!

View solution in original post

8 REPLIES 8
CarlosFigueira
Power Apps
Power Apps

You can use the TimeZoneOffset function for that. If you call it without parameters it will return you the current offset from UTC (in minutes) for the user's time zone.

@CarlosFigueira thank you for the info, but I want to know the time zone details.

 

Eg: UTC-4.30 or UTC+5.30

 

To which timezone he belongs too...

You can calculate that based on the value of the time zone offset. This expression should give you what you need:

"UTC"
    & If(TimeZoneOffset() > 0, "-", "+")
    & RoundDown(Abs(TimeZoneOffset()) / 60, 0)
    & ":"
    & If(Mod(Abs(TimeZoneOffset()), 60) < 10, "0", "")
    & Mod(Abs(TimeZoneOffset()), 60)

Hope this helps!

View solution in original post

@CarlosFigueira thank you for your help. It's working 

@CarlosFigueira would it possible to show the timezone in GMT instead of UTC?

Hi @krishnags . You can just substitute the string "UTC" for "GMT" in @CarlosFigueira 's given function. That being said, you'll have to be careful when describing British Daylight Savings Time.
You might also consider the Azure Maps Timezone API as an alternative to calculating timezones. Its always up to date and lots of optional output.

rahulswimmerfp
Regular Visitor

Hello Everyone. I have created the following UI in powerapps:
Screenshot 2020-05-10 at 7.53.57 PM.png

 

Example:
Time Zone 1: India, UTC+05.30
Time Zone 2: London, UTC+00:00
Select Date: 24/05/2020

Select Time: 07:00:00 AM

I need to convert Selected Date (i.e. 24/05/2020) and Selected Time (i.e. 07:00:00 AM) from UTC+05.30 to UTC+00.00. So if 7 AM in India should be 11.30 AM in London in today's time.

How can I achieve this using Powerapps or Power Automate ?

Please Help!

Hi, how are you accounting for time change? I was assuming -5 UTC from the above formula would meant East time. But apparently when the time changes it moved to -4 UTC

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (58,871)