Updated on

DateTimeZone.ZoneHours is a Power Query M function that returns number of hours specified in a datetimezone value.

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


DateTimeZone.ZoneHours( dateTimeZone as nullable datetimezone ) as nullable number


DateTimeZone.ZoneHours is designed to return the hour component of the Time Zone of a datetimezone value.


To help you grasp how DateTimeZone.ZoneHours operates, let’s explore a few examples. This function is designed to extract the hours from the timezone value. For example, the formula below will return 2:

DateTimeZone.ZoneHours( #datetimezone( 2023, 6, 10, 4, 8, 12, 2, 31 ) ) // 2

In another scenario, if we adjust the timezone hours in the formula, it will return 5:

DateTimeZone.ZoneHours( #datetimezone( 2023, 6, 10, 4, 8, 12, 5, 31 ) ) // 5

In conclusion, DateTimeZone.ZoneHours allows you to extract the hour component from a datetimezone value. This is especially when dealing with data across different timezones.

Other functions related to DateTimeZone.ZoneHours are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: