The utcNow Function is equivalent to Now function in SharePoint and PowerApps, but it always returns the current date in UTC. SharePoint and PowerApps consider the timezone and return the converted time.
Usage
It follows a simple pattern.
- (Optional) Date Format
Example:
utcNow('yyyy-MM-ddTHH:mm:ss')
will return
'2019-08-28T15:19:44'
Please be aware that, in the reference material, Microsoft names objects like ‘2019-10-28T10:10:00Z’ as timestamps. I prefer calling them “Date” to avoid confusion with the UNIX timestamp, commonly used in APIs, to represent the number of seconds elapsed since Jan 01, 1970 (UTC).
Limitations
Flow always returns dates in UTC. It can be a blessing since we can count on having a defined timezone and can be sure that we always store it in the same format, but can be cumbersome since we still need to perform extra steps to convert to the timezone that we want to display to the end-user.
Recommendations:
- Always include the format, even if the value is optional. The default value is “yyyy-MM-ddTHH:mm:ss:fffffffK” but you should control what the end-user will see. You can define a single format specifier (for example “o”) or a custom format pattern (for example “yyyy-MM-dd”) so pick your favorite, but be sure to define it.
- Since it can be confusing for the user to see the dates in UTC, you can use Flow’s “Convert Time Zone” action that will enable you to convert the date. Please use this and don’t try to do the math yourself. Otherwise, you may show invalid times to the user.
Sources:
Microsoft’s utcNow Function Reference
Back to the Power Automate Function Reference.
Featured Image by Heather Zabriskie on Unsplash