DateTimeZone.RemoveZone

DateTimeZone

Strips the timezone information from a datetimezone value, returning a datetime.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

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

Parameters

NameTypeRequiredDescription
dateTimeZonedatetimezoneYesThe datetimezone value to strip timezone information from.

Return Value

datetimeA datetime value with the same date and time as the input, but without timezone offset information.

Remarks

DateTimeZone.RemoveZone strips the UTC offset from a datetimezone value and returns a plain datetime with the same date and time components. The time value itself is not adjusted — only the timezone annotation is removed. This is distinct from DateTimeZone.ToUtc, which first converts the time to UTC before returning a datetime.

Use this function when you need a plain datetime for compatibility with functions or data destinations that do not accept datetimezone values. A common scenario is converting DateTimeZone.FixedUtcNow() or DateTimeZone.LocalNow() down to a datetime for use in duration arithmetic or comparison with datetime-typed columns.

If the input is null, the function returns null. When your goal is to normalize all timestamps to UTC before removing the zone, pipe through DateTimeZone.ToUtc first: DateTimeZone.RemoveZone(DateTimeZone.ToUtc(myDTZ)).

Examples

Example 1: Strip timezone from timestamps to produce plain datetimes

#table(
    type table [WithZone = datetimezone, WithoutZone = datetime],
    {
        {#datetimezone(2024, 1, 15, 9, 30, 0, -5, 0),  DateTimeZone.RemoveZone(#datetimezone(2024, 1, 15, 9, 30, 0, -5, 0))},
        {#datetimezone(2024, 3, 15, 14, 0, 0, 1, 0),   DateTimeZone.RemoveZone(#datetimezone(2024, 3, 15, 14, 0, 0, 1, 0))},
        {#datetimezone(2024, 6, 1, 9, 0, 0, 5, 30),    DateTimeZone.RemoveZone(#datetimezone(2024, 6, 1, 9, 0, 0, 5, 30))}
    }
)
Result
WithZone
WithoutZone
11/15/2024 2:30:00 PM1/15/2024 9:30:00 AM
23/15/2024 1:00:00 PM3/15/2024 2:00:00 PM
36/1/2024 3:30:00 AM6/1/2024 9:00:00 AM

Example 2: Remove zone from a specific datetimezone

#table(
    type table [WithZone = datetimezone, WithoutZone = datetime],
    {{#datetimezone(2024, 3, 15, 14, 30, 0, -5, 0),
      DateTimeZone.RemoveZone(#datetimezone(2024, 3, 15, 14, 30, 0, -5, 0))}}
)
Result
WithZone
WithoutZone
13/15/2024 7:30:00 PM3/15/2024 2:30:00 PM

Example 3: Normalize to UTC then remove zone

let
    Input = #datetimezone(2024, 3, 15, 9, 0, 0, -5, 0),
    AsUTC = DateTimeZone.ToUtc(Input),
    AsDatetime = DateTimeZone.RemoveZone(AsUTC)
in
    #table(
        type table [Original = datetimezone, UTC = datetimezone, UTCDatetime = datetime],
        {{Input, AsUTC, AsDatetime}}
    )
Result
Original
UTC
UTCDatetime
13/15/2024 2:00:00 PM3/15/2024 2:00:00 PM3/15/2024 2:00:00 PM

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks