DateTimeZone.ToUtc

DateTimeZone.ToUtc is a Power Query M function that changes the timezone information of a datetimezone value to the UTC or Universal Time timezone. The function returns a datetimezone value with the UTC timezone information added or updated.

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

Syntax

DateTimeZone.ToUtc( dateTimeZone as nullable datetimezone ) as nullable datetimezone

Description

The DateTimeZone.ToUtc function allows you to standardize the timezone information of a datetimezone value to Coordinated Universal Time (UTC). This function is particularly useful when dealing with data from various timezones and you need to bring them all to a common standard for analysis or reporting.

When you apply DateTimeZone.ToUtc to a datetimezone value, it modifies the timezone component to align with UTC. This ensures that all your datetimezone values are consistent and comparable, regardless of their original timezone.

Examples

Let’s explore some practical examples where the DateTimeZone.ToUtc function can be beneficial. Suppose you have a dataset with timestamps from different timezones. To analyze this data effectively, you need to standardize these timestamps to a common timezone.

Here’s how you can use DateTimeZone.ToUtc to convert a datetimezone value to UTC:

DateTimeZone.ToUtc( #datetimezone( 2010, 12, 31, 11, 56, 02, 7, 30 ) )

This function call will convert the datetimezone value “31/12/2023 11:56:02 +07:30” to UTC.

Another case where this function is useful is if you’re working on a project with international collaborators. It is crucial to ensure that all datetimezone values are in a standard format that everyone can understand. By converting all datetimezone values to UTC, you can avoid confusion when planning appointments.

Other functions related to DateTimeZone.ToUtc are:

BI Gorilla Youtube Channel

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/datetimezone-toutc
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.