web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Issues with DataTime l...
Power Automate
Answered

Issues with DataTime linking to Calander Appointment

(0) ShareShare
ReportReport
Posted on by 18

Hi All,

 

I am new to making flows and I'm having trouble with linking a date into a Calander appointment.

What I am doing is when an email arrives, the flow will convert html to text and then I filter the body of the email to get the date/time from it. This part works correctly. See below. 

Email:

MRasmus_0-1682640943030.png

Filter: substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Work Start:'), 12),19)

Output: 

MRasmus_1-1682641082641.png

 

The next part is where I am having issues. I take the output of the filter and add it to the Calander appointment and then get this error: "String was not recognized as a valid DateTime. clientRequestId: 6db99979-f1da-4abd-8733-c098b87e6288"

 

I then tried to use formatDateTime to change the output into ISO 8601 format and then take that output and put it into the Calander appointment, but I then get the below error when it attempts the formatDateTime.

 

Expression: formatDateTime(outputs('Work_Start'), 'yyyy/MM/dd hh:mm tt')

Error: Unable to process template language expressions in action 'Work_Start_Reformat' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '18/05/2023 06:00 AM' was not valid. The datetime string must match ISO 8601 format.'.

 

In the error I can see that is has taken the correct time from the Work Start step. I have been looking around and haven't been able to find how to fix this. 

I am hoping someone will be able to point out what i am missing to make this work. 

(I will need to do the same thing for Work End but i will hold off doing that till I get Work Start working)

 

Below is screenshot of the flow.

MRasmus_2-1682641495127.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-peijunz-msft Profile Picture
    Microsoft Employee on at

    Hi @MRasmus 

     

    Based on your description, I have made a simple test for your reference.

    1. Here is the flow:

    split(outputs('Compose'),' ')[0]
    split(split(outputs('Compose_2'),' ')[0],'/')
    concat(outputs('Compose_3')[2],'-',outputs('Compose_3')[1],'-',outputs('Compose_3')[0])
    formatDateTime(outputs('Compose_4'),'yyyy-MM-ddTHH:mm:ssZ')

    vpeijunzmsft_1-1682651062424.png

    vpeijunzmsft_2-1682651134371.png

     

    2. Result:

    vpeijunzmsft_0-1682650972163.png

    vpeijunzmsft_3-1682651175816.png

     

    Here is the doc for your reference:

    How to Convert a String to Date in Power Automate | Power Tech Tips

     

    Hope it helps!

     

    Best regards,

    Sylvia

  • MRasmus Profile Picture
    18 on at

    Thanks for your reply @v-peijunz-msft 

    Just before your reply I found a post with the below setup which work which is basically that same as your post.

     
    Work Start Split: split(outputs('Work_Start'),'/')

     

     

    Work Start Reformat: concat(outputs('Work_Start_Split')[1],'/',outputs('Work_Start_Split')[0],'/',outputs('Work_Start_Split')[2])

     

     

     

    I then linked the Work Start Reformat to the Calander appointment without the formatDateTime function and it worked 🙂

     

    Having seen your setup, you have 2 split functions, but I have 1. is my setup not ideal and do I need to add another split function? and do I need to use the formatDateTime function?

    Just wondering if my setup will cause issues down the line.

  • v-peijunz-msft Profile Picture
    Microsoft Employee on at

    Hi @MRasmus 

     

    Your method also works! You could choose the way you preferred.

    I just use formatDateTime to the format the style I like:)

     

    Anyway, your solution is great, I think you could mark the solution to let more people with the same problem to solve their own problem as quick as possible, and close the case now.

    Thank you so much!

     

    Best Regards,

    Sylvia

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard