parseDateTime expression problem

Jonas Spitaels 0 Reputation points
2023-12-05T10:47:02.6133333+00:00

Hi!

When I am trying to parse the following datetime using the parseDateTime expression:

parseDateTime('Mon, 05 Dec 2023 08:49:15 GMT', 'en-US', 'r')

I get the following error:

InvalidTemplate

Unable to process template language expressions in action 'Compose_3' inputs at line '0' and column '0': 'In function 'parseDateTime', the value provided for date time string 'Mon, 05 Dec 2023 08:49:15 GMT' was not valid. The datetime string must match ISO 8601 format.'.

What am I doing wrong?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,969 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Luis Arias 5,901 Reputation points
    2023-12-06T16:26:07.99+00:00

    Hi Jonas,

    You are trying to use a date on RFC 1123 format ( https://learn.microsoft.com/en-us/dotnet/api/system.globalization.datetimeformatinfo.rfc1123pattern?view=net-8.0) and you need to use a format ISO 8601for example: ‘2023-12-05T08:49:15Z’.

    User's image

    The option is convert the date with logicapp expressions as an example:

    @{concat(split(variables('YOURDATEVAR'),' ')[3],'-',formatDateTime(concat('2023-',split(variables('YOURDATEVAR'),' ')[2],'-01'), 'MM'),'-',split(variables('YOURDATEVAR'),' ')[1])
    

    Luis


    If the information helped address your question, please Accept the answer.

    0 comments No comments