cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate IV
Advocate IV

UTC issues

I live in the UK - my windows 10 is set to UK locale settings. The UK is presently in BST settings, so the time is +1hr from UTC.

 

If I add a DatePicker to a PowerApp and set its defualt date to Today() and set the datetimezone to UTC its shows the date as yesterday! 

 

Testing this right now the time in the uk is 12:47pm, so 11:47am UTC - so why is it showing yesterday as the date?

 

Regards

2 REPLIES 2
Highlighted
Super User
Super User

Re: UTC issues

Hi @JC75

 

Just to give a bit of background for other readers, PowerApps generally attempts to convert datetime values to the local value. Taking the example of a system that stores UTC appointment times in a database, the controls in PowerApps will automatically convert the source data to the local time. Therefore, two concurrent users who are viewing a record in the UK and the US would see an appointment time that's relevant to their location.

When you set the DateTimeZone property of a datepicker control to UTC, the datepicker assumes that the input value is in UTC. The control will correct this input value and display the local value to the user.

Let's assume that I'm in the UK. If I run the Today() function at this moment, the function will return 16/08/2018. Note that the Today() function returns just the date component, whereas Now() returns both the date and time.

If I set the default property of a datepicker control to Today(), the control assumes an input value of '16/08/2018 00:00 UTC'. It recognises that my timezone is BST and subtracts 1 hour to show the input value in my local time. The resultant value is '15/08/2018 23:00', and that's the reason why you see yesterdays date in your control. Hope that clarifies things a little for you.

Highlighted
Advocate IV
Advocate IV

Re: UTC issues

Hi thanks for the explanantion and understand - and equally can see the value of when someone wants UTC times from a database to be shown in local times on a screen, dependent upon their location. But seems that the methodlogy and settings of powerapps could do with being made clearer - so that the user/developer can be more in control of if its all UTC or if it coverts (whether that be input or output) 

 

Someway of both globally and for individiual controls setting timezone method would make this all a lot simpler, as it equally becomes annoying when you are filtering lists/datasources, and having to consider x=today actually might not be the case!

 

For some apps we are developing it should always be UTC, both in what its displaying to user and outputting to any datasource, and i want it to never consider the location or if any form of daylight saving is taking place. An example is industries like aviation, it operates in UTC at all times, regardless of where in the world they are, so everything is displayed in UTC.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,344)