OpenBI Docs Buy

Time.EndOfHour

The last moment of the hour a time falls in, a tick before the next hour.

Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Time.EndOfHour(dateTime as any) as any
ParameterTypeDescription
dateTimeanyA time, datetime or datetimezone value; null gives null.

Returns

any. The same kind of value, at minute 59 and second 59.9999999; a date comes back as it is.

Remarks

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

Examples

Last moment before 15:00

Time.EndOfHour(#datetime(2024, 3, 15, 14, 37, 12))
#datetime(2024, 3, 15, 14, 59, 59.9999999)

With a time zone

Time.EndOfHour(#datetimezone(2024, 3, 15, 14, 37, 0, 5, 30))
#datetimezone(2024, 3, 15, 14, 59, 59.9999999, 5, 30)

Time.StartOfHour, Date.EndOfDay, Time.Hour.

Last updated · OpenBI Studio 0.3.79