OpenBI Docs Buy

Date.EndOfDay

The last moment 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.EndOfDay(dateTime as any) as any
ParameterTypeDescription
dateTimeanyA date, datetime or datetimezone value; null gives null.

Returns

any. The same kind of value, at 23:59:59.9999999; a date unchanged.

Remarks

  • A datetimezone keeps its offset.
  • To test whether a moment falls on a day, comparing with the next day's start (<) is often simpler than with the day's end (<=).

Examples

The cut-off for same-day orders

Date.EndOfDay(#datetime(2024, 3, 15, 9, 30, 0))
#datetime(2024, 3, 15, 23, 59, 59.9999999)

With a time zone

Date.EndOfDay(#datetimezone(2024, 3, 15, 9, 30, 0, 1, 0))
#datetimezone(2024, 3, 15, 23, 59, 59.9999999, 1, 0)

Date.StartOfDay, Date.EndOfMonth, DateTime.Date.

Last updated · OpenBI Studio 0.3.79