Objective:
Convert CET/CEST time to UTC
Used below logic app expression:
convertTimeZone('timestamp', 'sourceTimeZone', 'destinationTimeZone', 'format'?)
My Logic app Design as below:
HTTP trigger and a compose action to convert the DateTime.
Workflow Image
TriggerBody
Issue-1
Testing 2024-10-27T01:00:00 CEST time and the converted UTC timestamp is 2024-10-26T23:00:00+00:00. Which is correct and as expected. CEST-02:00 = UTC.
ExpectedConversion&Valid
Testing 2024-10-27T02:00:00 which is either CEST or CET. The conversion failed with below error.
Unable to process template language expressions in action 'ConvertedDateTime' inputs at line '0' and column '0': 'The template language function 'convertTimeZone' was given a timestamp '2024-10-27T02:00:00.0000000' that was invalid or ambiguous in the source time zone 'W. Europe Standard Time'.'.
Failed Conversion
Is there any format am i missing in the input here???
Logic app supposed to consider this timestamp (2024-10-27T02:00:00) either in CEST or CET and convert into UTC, isn't???
Issue-2
The converted time stamp doesn't include the timezone offset info.
Converting UTC > IST. IST is ahead of 05:30 hours than UTC. Input provided 2025-01-01T00:00:00 and expected was 2025-01-01T05:30:00+05:30 but the result is 2025-01-01T05:30:00+00:00. The time is converted but no timezone info set.
TimeZoneOffsetMissing
Referred below MS docs for all these
Objective:
Convert CET/CEST time to UTC
Used below logic app expression:
convertTimeZone('timestamp', 'sourceTimeZone', 'destinationTimeZone', 'format'?)
My Logic app Design as below:
HTTP trigger and a compose action to convert the DateTime.
Workflow Image
TriggerBody
Issue-1
Testing 2024-10-27T01:00:00 CEST time and the converted UTC timestamp is 2024-10-26T23:00:00+00:00. Which is correct and as expected. CEST-02:00 = UTC.
ExpectedConversion&Valid
Testing 2024-10-27T02:00:00 which is either CEST or CET. The conversion failed with below error.
Unable to process template language expressions in action 'ConvertedDateTime' inputs at line '0' and column '0': 'The template language function 'convertTimeZone' was given a timestamp '2024-10-27T02:00:00.0000000' that was invalid or ambiguous in the source time zone 'W. Europe Standard Time'.'.
Failed Conversion
Is there any format am i missing in the input here???
Logic app supposed to consider this timestamp (2024-10-27T02:00:00) either in CEST or CET and convert into UTC, isn't???
Issue-2
The converted time stamp doesn't include the timezone offset info.
Converting UTC > IST. IST is ahead of 05:30 hours than UTC. Input provided 2025-01-01T00:00:00 and expected was 2025-01-01T05:30:00+05:30 but the result is 2025-01-01T05:30:00+00:00. The time is converted but no timezone info set.
TimeZoneOffsetMissing
Referred below MS docs for all these https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#converttimezone https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11
The converted time stamp doesn't include the timezone offset info. Converting UTC > IST. IST is ahead of 05:30 hours than UTC. The time is converted but no timezone info set.
You need to use custom formatting include the offset like using below design:
concat(variables('var'),'+',formatDateTime(convertTimeZone(variables('var'), 'UTC', 'India Standard Time'),'HH:mm:ss'))
Output:
Testing 2024-10-27T01:00:00 CEST time and the converted UTC timestamp is 2024-10-26T23:00:00+00:00. Which is correct and as expected. CEST-02:00 = UTC. Testing 2024-10-27T02:00:00 which is either CEST or CET. The conversion failed with below error.
This happens because DST Transition on that day. To make it work you need to add offset.
addToTime('2024-10-27T02:00:00', 1, 'Hour')
Output: