convertTimeZone function(Power Automate Cloud flows)

10/10/2023

Japanese version.

convertTimeZone is a function used in Power Automate expressions, It converts a date and time in Coordinated Universal Time (UTC) to a specified time zone.

This is similar to the Convert time zone.

FunctionSourceDestination
convertTimeZoneAnyAny
convertFromUtcCoordinated Universal Time (UTC)Any
convertToUtcAnyCoordinated Universal Time (UTC)
Comparison with similar functions.

Depending on the locale, it may be more efficient to use the convertFromUtc function to convert from Coordinated Universal Time (UTC) to another time zone.
This is the most common use since the result of getting the current time is in Coordinated Universal Time (UTC).

The convertTimeZone function is primarily used to convert from a time zone other than Coordinated Universal Time (UTC) to another time zone other than Coordinated Universal Time (UTC).

Spec

convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>')
ArgumentDefaultDescription
timestampRequired fieldSpecifies the date of the conversion source.
Specify in the format to be obtained by the current time action or utcNow function (format unspecified).
Any format other than "yyyy-MM-ddTHH:mm:ss.fffffffK" will result in an error.
sourceTimeZoneRequired fieldSpecifies the time zone before conversion.
destinationTimeZoneRequired fieldSpecifies the time zone after conversion.
formatyyyy-MM-ddTHH:mm:ss.fffffffKSpecifies the format of the result.
If not specified, the format is "yyyy-MM-ddTHH:mm:ss.fffffffK" as well as "timestamp".

How to use

In most cases, it is used in the "value" when initializing or setting variables of type "string".

Click on the "Expression" tab, convertTimeZone, and the function name and () will be set in the expression field.

Specify arguments.

  • The first argument. Date and time before conversion
  • The second argument. The time zone of the conversion source.
  • The third argument. The time zone after conversion.
  • The fourth argument. Specifies the format of the result.

When using dynamic content or variables, special specifications are required.

Click on the button, and if the display looks like the following, the setting is complete.

You can change the function by clicking this purple icon.

For example, "convertTimeZone('2022-05-01T14:00:00.0000000Z', 'UTC','Central America Standard Time')" the result will be January 1, 2022 at 8:00.

Argument 4 is an optional item. This item specifies the format after conversion.

If omitted, the format is the same as timestamp.

This is the same format as the result of the "Current time" action or the utcNow function (format not specified).

For those who want to learn Power Automate Cloud flow effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Cloud flow to streamline your workflow.

Links

Date and time Functions(Power Automate Cloud flows)