cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveP53
New Member

Power Automate Time Conversion from Form Submission Failing

I am having an issue with converting time. I have a form that is being filled out. The form includes date selections. When a user completes the form, I have a Power Automate Trigger that is grabbing the data that fills in an excel sheet send an email to our support desk with the request. The dates are coming in as a 5-digit number. I am now trying to convert that number to an ISO 8601 format, but I keep getting an error when testing the flow. I am using this to format the date formatDateTime(outputs('Get_a_row')?['body/1st Choice Date'],'d')

 

Error
Action 'Send_an_email_notification_(V3)' failed

Unable to process template language expressions in action 'Send_an_email_notification_(V3)' inputs at line '1' and column '20858': 'In function 'formatDateTime', the value provided for date time string '44263' was not valid. The datetime string must match ISO 8601 format.'.

 
1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @SteveP53 ,

dates from Excel file are not provided as dates, but as a number of days from the 'base' date of 12/30/1899. You can use the addDays(...) expression to calculate that date, example:

addDays('12/30/1899',int(outputs('Get_a_row')?['body/1st Choice Date']))

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
tom_riha
Super User
Super User

Hello @SteveP53 ,

dates from Excel file are not provided as dates, but as a number of days from the 'base' date of 12/30/1899. You can use the addDays(...) expression to calculate that date, example:

addDays('12/30/1899',int(outputs('Get_a_row')?['body/1st Choice Date']))

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

It looks like if I add the formatdatetime expression before your expression, which gives me the result I needed. Thank you for your help @tom_riha.

 

formatDateTime(addDays('12/30/1899',int(outputs('Get_a_row')?['body/1st Choice Date'])),'d')

 

SteveP53
New Member

@tom_riha I have a similar issue when trying use the completion date/time stamp. Below I am getting this response.

 

 

Unable to process template language expressions in action 'Send_an_email_notification_(V3)' inputs at line '1' and column '20621': 'In function 'formatDateTime', the value provided for date time string '44261.6041898148' was not valid. The datetime string must match ISO 8601 format.'.

 

 

I tried these three formats, all fails.

 

 

formatDateTime(addDays('12/30/1899',int(outputs('Get_a_row')?['body/Completion time'])),'g')
formatDateTime(UTC((outputs('Get_a_row')?['body/Completion time'])),'g')
formatDateTime(outputs('Get_a_row')?['body/1st Choice Date'],'d')

 

Ok, after some searching I found a way to extract date and time from an excel sheet and convert it to a proper Date Time format in an email using the formateDateTime expression. Thanks to @tom_riha for getting me the expression that works for converting date only from an excel sheet which was the original solution. The below expression captures the Date and Time stamp.

 

formatDateTime(addseconds('1899-12-30',int(formatnumber(mul(float(outputs('Get_a_row')?['body/Completion time']),86400),'0'))),'g')

 

 

Credit for this expression goes to RYAN MACLEAN CONVERTING EXCEL DATE TIME SERIAL VALUES WITH POWER AUTOMATE .

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,625)