DateTimeZone.ToRecord

Updated on

DateTimeZone.ToRecord is a Power Query M function that extracts the parts of a given datetimezone value as a record. The function returns a record containing the year, month, day, hour, minute, second, fraction of a second, and timezone information.

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

Syntax

DateTimeZone.ToRecord( dateTimeZone as datetimezone ) as record

Description

The DateTimeZone.ToRecord function returns a record containing the parts of the given datetimezone value, dateTimeZone.

Examples

To better understand how DateTimeZone.ToRecord works, let’s look at an example. This function can convert the datetimezone value #datetimezone( 2011, 12, 31, 11, 56, 2, 8, 0 ) into a record containing Date, Time, and Zone values:

/* Returns a record with all the components of a datetimezone value.
[
      Year = 2023,
      Month = 12,
      Day = 31,
      Hour = 10,
      Minute = 55,
      Second = 2,
      ZoneHours = 2,
      ZoneMinutes = 0
]
*/
DateTimeZone.ToRecord( #datetimezone( 2023, 12, 31, 10, 55, 2, 2, 0 ) )
DateTimeZone.ToRecord Function in Power Query M

In conclusion, DateTimeZone.ToRecord allows you to extract the parts of a given datetimezone value as a record. It’s especially useful when dealing with data across different timezones.

Other functions related to DateTimeZone.ToRecord are:

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

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy