cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
xsomej
Level: Powered On

Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

Hi all,

 

I want to build a simple flow:
After a defined field is checked, add 1 year to a date/time field in SharePoint list.

 

I'm using Czech reginal settings, so dates in my SharePoint list are in this format:

dd.MM.yyyy (14.05.2019 for today)
 
For adding one year, I'm using this expression on compose function:
formatDateTime(addDays(triggerBody()['ConfirmationDateBanks0'],366),'dd.MM.yyyy')
 
where ConfirmationDateBanks0 is the fdate/time field I'm targeting for the change.
 
But for some reason, I'm getting this error:
String was not recognized as a valid DateTime
 
Any idea why?
Setup + error screeshots are attached.

 

Thanks for any reply.

 

Flow error 2.PNGFlow output and errorFlow error.PNGFlow setup

2 ACCEPTED SOLUTIONS

Accepted Solutions
Dual Super User
Dual Super User

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

@xsomej 

You should inspect firt the date time format received in the flow, if the only problem is that the time part is missing you can simply add it:

concat(triggerBody()['ConfirmationDateBanks0'],'T13:00:00Z')

 

You can add a Compose action block to inspect the content of the datetime column received in flow; or check the execution of the flow trigger (all columns returned should be visible there)

Hope this helps

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
xsomej
Level: Powered On

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

Thanks @efialttes,

 

I found the issue: had to treat the date in this format:

formatDateTime(addDays(triggerBody()['ConfirmationDateBanks0'],366),'yyyy-MM-dd')

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

@xsomej 

The sharepoint column you are using is not Date/Time format, right?

 

adddays() expects a specific datetimeformat, see the following example taken from WDL functions reference

addDays('2018-03-15T13:00:00Z', 10)

So if sharepoint column is a string, you need to manipulate it in order to match the expected format

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



xsomej
Level: Powered On

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

Hi @efialttes,

 

it is a Date/Time column.

So I always have to use the time as well, right?

Dual Super User
Dual Super User

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

@xsomej 

You should inspect firt the date time format received in the flow, if the only problem is that the time part is missing you can simply add it:

concat(triggerBody()['ConfirmationDateBanks0'],'T13:00:00Z')

 

You can add a Compose action block to inspect the content of the datetime column received in flow; or check the execution of the flow trigger (all columns returned should be visible there)

Hope this helps

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
xsomej
Level: Powered On

Re: Update Sharepoint List - Add 1 year to a date - String was not recognized as a valid DateTime error

Thanks @efialttes,

 

I found the issue: had to treat the date in this format:

formatDateTime(addDays(triggerBody()['ConfirmationDateBanks0'],366),'yyyy-MM-dd')

View solution in original post

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,922)