Time.EndOfHour

Updated on

Time.EndOfHour is a Power Query M function that calculates the end of the hour for a given dateTime value, including fractional seconds. The function returns a time, datetime, or datetimezone value representing the end of the hour.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Time.EndOfHour( dateTime as any ) as any

Description

Time.EndOfHour returns the end of the hour represented by dateTime, including fractional seconds. Timezone information is preserved.

Examples

Get the end of the hour for 5/14/2011 05:00:00 PM.

// Output: #datetime( 2011, 5, 14, 17, 59, 59.9999999 )
Time.EndOfHour( #datetime( 2011, 5, 14, 17, 0, 0 ) )

Get the end of the hour for 5/17/2011 05:00:00 PM -7:00.

// Output: #datetimezone( 2011, 5, 17, 5, 59, 59.9999999, -7, 0 )
Time.EndOfHour( #datetimezone( 2011, 5, 17, 5, 0, 0, -7, 0 ) )

Other functions related to Time.EndOfHour are:

BI Gorilla Blog

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/time-endofhour