Flow and date formats
Updated: May 20, 2019
Showing data in a format that users understand is important and displaying so they can take the correct action is vital.
Default for flow is to use data data from Common Data Service (CDS) and display dates in UTC using this pattern: "yyyy-MM-ddTHH:mm:ssZ" example like this:
"2019-02-13T08:30:10Z" and this is not very user friendly and there are not many users using UTC (especially during daylight savings time), so the time is wrong as well.
Here we will show you how to display one field in the correct format and the correct time zone.
Go to https://flow.microsoft.com and then choose an environment that has CDS:
First off, this solution is base on that you have are using one of the Dynamics 365 Customer Engagement Apps, like sale, this allows users to have personal settings in the first place.
Consider that you want to show the modified on date as the users who did the modification.
So when a record is update (or created, the trigger "when a record is update" will trigger for both) we will run this. First get the settings for the user who did the update:
Note this name is set to "Get User Settings" I will use this name in a formula later on.
Unfortunately the user settings does not have a good name for the time zone, so we have to get the name, here we have to get a list, even when we have just a list of 1 records, and we will make sure about that and set the top count to 1:
Next up is using the user settings and produce some useful stings:
This is just two "Compose" actions with one line in each of them:
Now its time to find a "Convert time zone" action and add it, (no don't add the for each, that will be added once you add the field "standard name".
Note also that the modified on, is the "when a record is update" otherwise we get a field from other entities.
Base time, is then the "modified on" for the updated record, format string is the output from the date format + output from the time format (this can allow me to use the same approach if I ever want a solution using date only or time only fields.
Source time zone is always UTC, and Destination time zone is the output from the list of time zone definitions.
Done, we got everything that we need to convert one date time field, now we can reuse everything and just add "Convert time zone" actions for each field that we need converted.