DateTimeZone.FixedLocalNow

Updated on

DateTimeZone.FixedLocalNow is a Power Query M function that returns a datetime value set to the current date and time on the system with local timezone information. The function returns a fixed datetime value that will not change with successive calls.

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

Syntax

DateTimeZone.FixedLocalNow() as datetimezone

Description

Returns a datetimezone value set to the current date and time on the system. The returned value contains timezone information representing the local timezone. This value is fixed and will not change with successive calls, unlike DateTimeZone.LocalNow, which may return different values over the course of execution of an expression.

Examples

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

DateTimeZone.FixedLocalNow() 

// At the time of running this query the function returns
// #datetimezone( 2023, 7, 23, 14, 12, 29.0738, 2,0)
// represented by: 2023-07-23T14:12:29.0738000+02:00

A function like DateTimeZone.FixedLocalNow 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.

In case you want a fixed UTC value that does not depend on the location of your machine, you can resort to functions like DateTimeZone.FixedUtcNow or DateTimeZone.UtcNow. You can even have these account for daylight savings as explained in this article.

Other functions related to DateTimeZone.FixedLocalNow are:

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

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy