DateTimeZone.FixedUtcNow

Updated on

DateTimeZone.FixedUtcNow is a Power Query M function that provides the current date and time in UTC (GMT timezone) as a fixed value. The function returns a datetime value that will not change with successive calls.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

DateTimeZone.FixedUtcNow() as datetimezone

Description

Returns the current date and time in UTC (the GMT timezone) as datetimezone value. This value is fixed and will not change with successive calls, unlike the DateTimeZone.LocalNow function.

Examples

Let’s see an example of the DateTimeZone.FixedUtcLocal now function. Here’s the output of this function at the moment it was run:

DateTimeZone.FixedUtcNow() 

// At the time of running this query the function returns
// #datetimezone( 2023, 7, 23, 12, 56, 24.0738740, 0, 0)
// represented by: 2023-07-23T12:22:10.3589497+00:00

A function like DateTimeZone.FixedUtcNow returns the datetimezone the UTC time of the time the query is run. That means regardless of the location where your query is refreshed, it returns the same UTC time.

The following formula always returns the current UTC+2 time regardless of the location where it is refreshed.

DateTimeZone.SwitchZone( DateTimeZone.FixedUtcNow(), 2 )

// At the time of running this query the function returns
// #datetimezone( 2023, 7, 23, 12, 56, 24.0738740, 2, 0)
// represented by: 2023-07-23T12:22:10.3589497+02:00

This example turns UTC into a fixed timezone. To account for daylight savings you can check out this article.

Learn more about DateTimeZone.FixedUtcNow in the following articles:

Other functions related to DateTimeZone.FixedUtcNow are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/datetimezone-fixedutcnow