How to get Timezone of current user in Power Apps Canvas apps.

Date and Time related queries are kind of intriguing. With people from all over the globe, accessing an application from various timezones, handling date and time issues is not for faint hearted.

And related to that, there is a question – “How do I get the timezone of a user inside a Power App?”

When I heard this question the first time, for me the obvious answer was to use the Office 365 Users connector. After all, using this connector we can get all the information of a user and I was pretty sure we can get the timezone as well.

Alas, it does not get me the information I need. You can try for yourself and have a look at it.

So now what? Is there no other way? If you are looking for a function in Power Apps which return you the timezone of the user, there is no such function. But we have a workaround.

There is a function in Power Apps – TimeZoneOffset which return the offset in minutes the current user’s timezone is, relative to UTC.

The current user set-up in the below example is in India Standard Time (IST)

As you see in the above screenshot, it is returning -330, which is basically 3 hours and 30 mins ahead of UTC.

Okay, we got part of what we need. Now how to get the formatted timezone value, there can be two ways depending on the output you need.

If I want to display in the format of UTC+05:30, that’s fairly simple. The below formula will do it.

"UTC+" & Abs(RoundDown(TimeZoneOffset(Now())/60,0)) & ":" & Mod(TimeZoneOffset(Now()),60)

If you want more specific like “India Standard Time“, you can keep a collection of timezones and then find the offset and display the timezone name.

Declaring the collection

Collect(
    _timeZones,
    {
        Offset: -330,
        Name: "India Standard Time"
    },
    {
        Offset: 480,
        Name: "Pacific Time (US & Canada)"
    }
);

Displaying the timezone name

LookUp(_timeZones, Offset = TimeZoneOffset(Now())).Name

The latter one, not a great way though considering there is Daylight savings. But nonetheless it can act as a starter.

Hope this helped!

You will also like the below posts.

Debajit Dutta
Business Solutions MVP