DateTimeZone.RemoveZone

Updated on

DateTimeZone.RemoveZone is a Power Query M function that removes timezone information from a datetimezone value. The function returns a #datetime value without timezone information.

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

Syntax

DateTimeZone.RemoveZone( dateTimeZone as nullable datetimezone ) as nullable datetime

Description

The DateTimeZone.RemoveZonetakes a datetimezone value as its input and returns a datetime value. This function is particularly useful when you’re dealing with data that includes timezone information, but you want to standardize or simplify the data by removing this information. The returned datetime value is identical to the original datetimezone value, but without any timezone information.

Examples

Let’s delve into a example to better understand how the DateTimeZone.RemoveZone function works.

Suppose you’re analyzing a dataset that includes timestamps from different timezones. To simplify your analysis, you might want to remove the timezone information and just work with the dates and times. Here’s how you can do it:

// Output: #datetime(2023, 12, 31, 9, 15, 36)
DateTimeZone.RemoveZone( #datetimezone( 2023, 12, 31, 9, 15, 36, -7, 0 ) )

This function call will convert the datetimezone value “2023-12-31T09:15:36-07:00” into the datetime value “2023-12-31T09:15:36”, effectively removing the timezone information.

Other functions related to DateTimeZone.RemoveZone are:

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