DateTime.Date
Returns the date part of a date and time, with the time removed.
DateTime.Date(dateTime as nullable datetime) as nullable dateReturns: The date, or null when the input is null.
What it does
DateTime.Date keeps the date and drops the time. It does the same job as Date.From on a datetime value, and it is clearer when a reader is looking for the "date part" of a timestamp. Use it to group timestamped transactions by the day they happened on.
Syntax and arguments
- dateTime: a datetime value, for example from a timestamp column.
Example
A payment processor exports each charge with a timestamp in local time. The settlement team groups the charges by the day they were made, so each day can be matched to a bank deposit.
let
Charges = #table(type table [Charge = text, ChargedAt = datetime, Amount = number],
{{"CH-1", #datetime(2026, 10, 29, 9, 15, 0), 120},
{"CH-2", #datetime(2026, 10, 29, 23, 40, 0), 80},
{"CH-3", #datetime(2026, 10, 30, 0, 5, 0), 200}}),
ByDay = Table.AddColumn(Charges, "ChargeDate", each DateTime.Date([ChargedAt]), type date),
Daily = Table.Group(ByDay, {"ChargeDate"}, {{"Total", each List.Sum([Amount]), type number}})
in
Daily
CH-1 and CH-2 are both on October 29 and total 200. CH-3 is just after midnight, so it falls on October 30. The 23:40 charge stays with its day, which is what the deposit will show.
Example: a second, different use
Compare the date of a payment with the date of its invoice, after both have been reduced to dates, so a same-day payment is recognized.
Things to watch
- The time part is removed, so a charge just before midnight and one just after land on different days.
- Time zones matter. A timestamp in UTC can fall on the next day in local time, so convert the time zone first.
- The result is a date, so it can be compared with other dates directly.
- Null in gives null out.
In business terms
Settlement, deposit matching and daily sales reports need timestamps grouped by day, and a late evening sale that lands on the wrong day causes a mismatch that takes an afternoon to find. Getting the date part right at the start prevents that.