Expression: Considerations when working with the DateTimeConvert function

DateTimeConvert(DateTime, “SourceZone”, “DestinationZone”) -> DateTime.

The DateTimeConvert function takes a datetime and allows you to specify:

  • Source zone - the time zone that the datetime belongs to.

  • Destination zone - the time zone that you want to convert the datetime to.

The result of the expression is the datetime in the second zone.

Please be aware of the following when working with the DateTimeConvert function:

  1. The time zone database is only supported on Windows 10 version 1903 or Windows Server 2022 or later:

    Microsoft Ignite - Time Zones

    Using the function on a version which can’t access the necessary time zone database will return missing values and a message in the debug log from the server indicating that the information cannot be found.

  2. The source and destination zones are strings, and may be variables.

  3. The valid values for the source and destination zones are taken from the IANA database of valid time zones, which can be found here:

    List of tz database time zones - Wikipedia

    The values in the TZ Identifier column are the relevant and important ones.

  4. If you specify a time that exists twice - such as, for example, during the shift between BST and GMT when the clocks go back - the DateTimeConvert function will return the earliest of the two times.

  5. If you enter an input time which falls into a time that doesn’t exist - such as, for example, during the shift from GMT to BST when the clocks jump forward - the DateTimeConvert function will return a missing value, and a supporting message to that effect.

 

Return to Expression: DateTime Functions