Todd Baginski's Blog - A SharePoint, Mobile, Office365, PowerApps and Azure Blog

Working with Local and UTC Dates and Times in PowerApps

9 March 2018

Comments:

1
 March 9, 2018
 1
Category: Office 365, PowerApps

Handling dates and times with Local time and UTC time when you are developing PowerApps can be tricky.  Believe me, I know.  🙂

“A man who dares to waste one hour of time has not discovered the value of life.” – Charles Darwin

“A man who dares to waste one hour of time developing PowerApps has not discovered this blog post.” – Todd Baginski

To make reading this blog post as awesome as possible, I highly recommend listening to Pink Floyd’s ‘Time’ in another browser window by clicking this link.

Alright, enough joking around, here are a couple of things related to Dates and Times to be aware of in PowerApps.

First, in case you never noticed, the Date Picker control in PowerApps allows you to set the Date time zone property.

Here’s one set to UTC time:

Here’s another set to Local time:

Depending which value you select, the date and time returned by the control will reflect the Local or UTC date and time.  Pay attention to this and make sure you set the property to meet your scenario.

Another thing to be aware of, the connectors that communicate with the Graph API (or any other API), or custom connectors you create, may return Local or UTC times, and they may also expect Local or UTC times as parameters.

Here’s an example of a date and time value coming back from the Graph API.

When you are developing PowerApps, you need to make sure you are always using the appropriate Local or UTC times to ensure all your data makes sense in the PowerApp as well as all the systems it integrates with.

You may also need to convert Local dates and times to UTC dates and times.  It all depends on your PowerApp and the connectors it uses.

To make this easier to figure out I created a sample PowerApp that demonstrates how Local and UTC Date Pickers work and also how to use the TimeZoneOffset function to convert Local to UTC time.

Here’s what it looks like.

You can also convert UTC to Local time pretty easily, but it’s not demonstrated in the sample PowerApp.  You can learn how to do that here.

Download the sample PowerApp here.

Now, quit wasting time and go download it!  🙂

Thanks, Ian Davis, for working through this with me.

One response on “Working with Local and UTC Dates and Times in PowerApps

  1. JamesM says:

    Hi Todd,
    Great post as it high lights some of the simple things that might trip up someone who is just starting out with PowerApps.