Date.StartOfDay

Date

Returns the first moment of the day (midnight) for the given date or datetime value.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Date.StartOfDay(dateTime as any) as any

Parameters

NameTypeRequiredDescription
dateTimeanyYesA date, datetime, or datetimezone value.

Return Value

anyA datetime or datetimezone value representing 00:00:00 on the given day.

Remarks

Date.StartOfDay returns the very first instant of the day — 00:00:00 — as a datetime. When passed a plain date, it returns a datetime with the time component set to midnight. When passed a datetimezone, it preserves the timezone offset and sets only the time components to midnight. This is useful for building inclusive lower-bound date range filters.

A common pattern is combining Date.StartOfDay and Date.EndOfDay to create an inclusive day range: [EventTime] >= Date.StartOfDay(start) and [EventTime] <= Date.EndOfDay(end). This avoids filtering bugs that arise from comparing a datetime column against a bare date value.

Note that Date.StartOfDay applied to a datetime truncates to midnight of that datetime's day. If the input is already 00:00:00, the output is unchanged. To truncate a datetime to a specific hour instead of midnight, use Time.StartOfHour.

Examples

Example 1: Filter log entries on or after the start of a specific day

Table.SelectRows(
    OrderLog,
    each [Timestamp] >= Date.StartOfDay(#date(2024, 1, 16))
)
Result
LogID
OrderID
Action
Timestamp
DurationMinutes
Notes
1L0021Shipped1/16/2024 2:15:00 PM1,725Shipped via express
2L0032Created1/18/2024 11:00:00 AMnullNew order: Gadget B
3L0042Shipped1/20/2024 8:45:00 AM2,745Standard shipping
4L0053Created2/1/2024 4:20:00 PMnullNew order: Widget C
5L0063Cancelled2/2/2024 10:05:00 AM1,065Customer request
6L0074Created2/10/2024 1:00:00 PMnullNew order: Gadget D
7L0084Shipped2/12/2024 9:30:00 AM2,670Shipped via express

Example 2: Return the start-of-day datetime for March 15, 2024

#table(
    type table [Result = datetime],
    {{Date.StartOfDay(#date(2024, 3, 15))}}
)
Result
Result
13/15/2024 12:00:00 AM

Example 3: Build an inclusive date range filter using StartOfDay and EndOfDay

let
    TargetDate = #date(2024, 1, 15),
    RangeStart = Date.StartOfDay(TargetDate),
    RangeEnd = Date.EndOfDay(TargetDate)
in
    Table.SelectRows(
        OrderLog,
        each [Timestamp] >= RangeStart and [Timestamp] <= RangeEnd
    )
Applied Steps

The final output — filters the OrderLog table to rows whose Timestamp falls on January 15, 2024.

LogID
OrderID
Action
Timestamp
DurationMinutes
Notes
1L0011Created1/15/2024 9:30:00 AMnullNew order: Widget A

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks