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
DateTimeZone.FixedUtcNow() as datetimezone
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.
Let’s see an example of the DateTime.FixedLocal 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.LocalNow returns the
datetimezone value belonging to the machine where a query is run. That means if your dataset refreshes in Ireland while you live in the Netherlands, it returns returns the Irish time.
You can implement your own logic to always return a specific
datetimezone value. 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:
- How to Create Today’s Date in Power Query M
Learn how to create the current date in Power Query! You can use Today’s date to make your queries dynamic and perform checks on timeliness. » Read more
Other functions related to DateTimeZone.FixedUtcNow are: