Handling time zone in Power Automate

The example described in this post shows how a date field selected in Dynamics 365 (where the timezone is GMT+11hrs) can be incorrectly displayed in Power Automate. Specifically, a date of 15/03/2021 in Dynamics 365 being incorrectly displayed as 14/03/2021 in Power Automate. It then describes a solution to this issue.

Issue

Consider the field ‘Agreement Date’

The ‘Agreement Date’ value is selected

When the date is stored in Dataverse, it’s stored as GMT+0hrs

When the date is read into Power Automate, it’s incorrectly set to the previous day

Solution

Set the format for the field as ‘Date and Time’

The time is now also displayed on the form. To hide this, add the following JavaScript to the form on load event

FormContext.getControl(“<publisher>_agreementdate”).setShowTime(false);

When the date is read in Power Automate, it now displays the time as well

The agreement date is then converted from GMT+0hrs to GMT+11hrs (1 extra hour for daylight savings)

The date now correctly displays within Power Automate