Downloads
Power Query MDate and timeIntermediate

DateTime.LocalNow

Returns the current date and time in the local time zone of the machine running the query.

Syntax
DateTime.LocalNow() as datetime

Returns: The current local datetime. The value can differ each time the query is evaluated.

What it does

DateTime.LocalNow gives the current date and time. It is the M version of NOW(), and it is the usual way to get today's date for an aging report, a days past due count, or a "data as of" label. Because it is calculated when the query runs, the value changes every time the query is refreshed, and it can differ between steps of the same query.

Syntax and arguments

Example

An aging report needs the days past due for each invoice as of today. Today's date is taken from DateTime.LocalNow and converted to a date, so the comparison is by calendar day.

let
    Today = Date.From(DateTime.LocalNow()),
    Invoices = #table(type table [Invoice = text, DueDate = date],
        {{"INV1043", #date(2026, 9, 15)}, {"INV1044", #date(2026, 10, 20)}}),
    Aging = Table.AddColumn(Invoices, "DaysPastDue", each Duration.Days(Today - [DueDate]), Int64.Type)
in
    Aging

The result depends on the day the query runs. Run on October 29, 2026, INV1043 shows 44 days past due and INV1044 shows 9. The next day, both counts rise by one, which is what an aging report should do.

Example: a second, different use

Add a "data as of" label to a report by taking the date from DateTime.LocalNow and formatting it with Date.ToText.

Things to watch

In business terms

Aging reports, days sales outstanding and "as of" dates on management reports all need today's date. Using it in one step, and labeling the report with the date it was run, avoids confusion when the same report is opened on different days.

Related functions

All Power Query M functions · View as Markdown · M basics