If you want to stamp the current date and time into a Power Query step, for example to record when a table was last refreshed, DateTime.LocalNow is the function you reach for.
It returns the system clock as a datetime value, and in this article I’ll show you how to use it.
Syntax of DateTime.LocalNow Function
DateTime.LocalNow() as datetime
where
DateTime.LocalNowtakes no arguments. You still write the empty parentheses(), since it is a function call.
Returns: a datetime value holding the current date and time when the function runs. The value reflects the machine or service the query runs on.
In plain terms, you call it with nothing inside the parentheses and it hands back “right now” as a date and time. If you are new to the M language, the getting started with Power Query guide is a good primer.
Example 1: Get the current date and time
Read the system clock as a single datetime value.
DateTime.LocalNow()
Result: a datetime value, for example 6/5/2026 2:32:10 PM
The exact value depends on when you run it, so it will differ from the one above.
Example 2: Get just today’s date
Wrap the call in Date.From to drop the time portion and keep only the date.
Date.From(DateTime.LocalNow())
Result: a date value, for example 6/5/2026
Date.From converts the datetime to a plain date, which is the cleanest way to get today’s date in Power Query.
Example 3: Get just the current time
Use DateTime.Time to pull the time portion out of the same call.
DateTime.Time(DateTime.LocalNow())
Result: a time value, for example 2:32:10 PM
This gives you a time value, useful when you only care about the hour and minute.
Example 4: Add an import timestamp to a table
A common use is to record when each row was loaded. Say you have an Orders table and want an Imported column with the refresh time.
Here is the starting data:
| OrderID | Customer | Amount |
|---|---|---|
| 1001 | Acme Corp | 2450 |
| 1002 | Globex | 1875 |
| 1003 | Initech | 3200 |
| 1004 | Umbrella | 990 |
Add a custom column that calls DateTime.LocalNow for every row:
let
Source = Excel.CurrentWorkbook(){[Name="Orders"]}[Content],
AddImported = Table.AddColumn(Source, "Imported", each DateTime.LocalNow(), type datetime)
in
AddImported
The result adds an Imported column to every row:
| OrderID | Customer | Amount | Imported |
|---|---|---|---|
| 1001 | Acme Corp | 2450 | 6/5/2026 2:32:10 PM |
| 1002 | Globex | 1875 | 6/5/2026 2:32:10 PM |
| 1003 | Initech | 3200 | 6/5/2026 2:32:10 PM |
| 1004 | Umbrella | 990 | 6/5/2026 2:32:10 PM |
Every row gets stamped with the time the query refreshed, so the timestamp updates on each refresh.
Things to keep in mind with DateTime.LocalNow
- It re-evaluates on every call. This is the key gotcha.
DateTime.LocalNowreads the clock each time it runs, so two calls in the same query can return slightly different times. When you need one fixed timestamp for the whole query, useDateTime.FixedLocalNowinstead, which snapshots the time once per evaluation. Once you have a timestamp, you can feed it into a date difference in Power Query to measure elapsed time. - Desktop returns local time, the service returns UTC. In Excel and Power BI Desktop you get your machine’s local time. Published to the Power Query Online experience or the Power BI service, it returns UTC, so a scheduled refresh can land on a different clock than your desktop.
- It returns a plain
datetime, with no timezone attached. The result carries no offset, so you cannot tell from the value alone whether it is local or UTC. When you need that offset stamped in, useDateTimeZone.LocalNoworDateTimeZone.UtcNowinstead.
Common questions about DateTime.LocalNow
What is the difference between DateTime.LocalNow and DateTime.FixedLocalNow?
DateTime.LocalNow reads the clock every time it is called, so values can drift within a single query. DateTime.FixedLocalNow captures the time once per evaluation and reuses that single value, which is what you want for a consistent “as of” timestamp.
Why does my added timestamp column differ from row to row?
Because DateTime.LocalNow runs once per row and the clock keeps moving. For an identical stamp on every row, compute the time once in a step (or use DateTime.FixedLocalNow) and reference that value in the column.
List of All Power Query Functions
Related Power Query Functions / Articles: