Format Time in Logic app

Vijay 101 Reputation points
2022-06-10T11:25:12.757+00:00

Hi,

I need to convert date into yyyy-MM-dd format and add it to sharepoint column

210244-image.png

Date is in the above format

I want to convert it

Im getting error
210257-image.png

Help me to solve this

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

Accepted answer
  1. Bruno Lucas 4,411 Reputation points MVP
    2022-06-10T12:56:09.72+00:00

    Hi,
    That may be a bit tricky because your date is not following the ISO 8601 format neither has delimiters like / or -

    If you see this thread: https://learn.microsoft.com/en-us/answers/questions/864847/mapping-data-to-sharepoint-columns-from-logic-app.html

    I managed to get that in SharePoint but that date at least had a delimiter: "-"

    If your date was 2022-04-12, you could use something like formatDateTime(concat(split(YOURINPUTDATEHERE, '-')[2],'-',split((YOURINPUTDATEHERE, , '-')[1],'-',split((YOURINPUTDATEHERE, , '-')[0]),'yyyy-MM-ddTHH:mm:ssZ')

    you can try : parseDateTime('21052019', 'fr-fr', 'ddMMyyyy') like specidied in https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#parsedatetime but you need to figure a way to flip your date to have day month year, like an array flip

    or you can change this: formatDateTime(concat(split(YOURINPUTDATEHERE, '-')[2],'-',split((YOURINPUTDATEHERE, , '-')[1],'-',split((YOURINPUTDATEHERE, , '-')[0]),'yyyy-MM-ddTHH:mm:ssZ')

    to use substrings , but you must be sure the date input will be always yyyyMMdd

    This worked for me:

    formatDateTime(concat(substring('20220412',0,4),'-',substring('20220412',4,2),'-',substring('20220412',6,2)),'yyyy-MM-ddTHH:mm:ssZ')  
    

    of course where you see '20220412', you pass your input date field

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful