Date.StartOfDay
Midnight at the start of the same day, for a datetime or datetimezone; a date comes back as it is.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Date.StartOfDay(dateTime as any) as any
| Parameter | Type | Description |
|---|---|---|
dateTime | any | A date, datetime or datetimezone value; null gives null. |
Returns
any. The same kind of value, at 00:00:00; a date unchanged.
Remarks
- A datetimezone keeps its offset: the day is its own clock's day, not UTC's.
Examples
The day an order was placed
Date.StartOfDay(#datetime(2024, 3, 15, 14, 30, 0))
#datetime(2024, 3, 15, 0, 0, 0)
With a time zone
Date.StartOfDay(#datetimezone(2024, 3, 15, 9, 30, 0, 1, 0))
#datetimezone(2024, 3, 15, 0, 0, 0, 1, 0)
A date
Date.StartOfDay(#date(2024, 3, 15))
#date(2024, 3, 15)
A date has no time of day, so it is its own start: a column of dates and datetimes can go through one step.