<!-- https://learnsql.cpetoday.com/functions/m/datetime-localnow -->
# DateTime.LocalNow

Language: Power Query M
Category: Date and time
Syntax: DateTime.LocalNow() as datetime
Summary: Returns the current date and time in the local time zone of the machine running the query.
Returns: The current local datetime. The value can differ each time the query is evaluated.
Level: Intermediate
Related: DateTime.FixedLocalNow, DateTime.Date, Date.From, Duration.Days, DateTimeZone.UtcNow

## 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
- The function takes no arguments. Empty parentheses are required.
## 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.

```powerquery
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
- Each refresh moves the date forward, so a report run on two days shows two different results. That is correct for aging but not for a fixed cut-off.
- It uses the time zone of the machine running the query. A server in another time zone can show a different date near midnight.
- For a fixed cut-off that never changes, type the date, or use a parameter.
- The value is a datetime. Convert to a date with Date.From before you count days.
## 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.
