DateTimeZone.UtcNow
DateTimeZoneReturns the current date and time in UTC.
Syntax
DateTimeZone.UtcNow() as datetimezoneReturn Value
datetimezone — The current UTC date and time.
Remarks
DateTimeZone.UtcNow returns the current date and time in UTC (Coordinated Universal Time) with a +00:00 offset. The value changes each time the query runs, so it cannot be used for reproducible results. It is commonly used for adding refresh timestamps or computing elapsed time relative to a fixed reference point.
Examples
Example 1: Display the current UTC datetime
#table(
type table [CurrentUTC = datetimezone],
{{DateTimeZone.UtcNow()}}
)Result
CurrentUTC | |
|---|---|
| 1 | 7/15/2024 3:30:00 PM |
Example 2: Add a UTC refresh timestamp to Sales
let
UtcNow = #datetimezone(2024, 7, 15, 15, 30, 0, 0, 0) // DateTimeZone.UtcNow()
in
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(Sales, 3),
{"OrderID", "CustomerName"}
),
"RefreshUTC", each UtcNow, type datetimezone
)Result
OrderID | CustomerName | RefreshUTC | |
|---|---|---|---|
| 1 | 1 | John Smith | 7/15/2024 3:30:00 PM |
| 2 | 2 | Sara Johnson | 7/15/2024 3:30:00 PM |
| 3 | 3 | Mike Davis | 7/15/2024 3:30:00 PM |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks