cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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 output and errorFlow output and errorFlow setupFlow setup

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

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
Helper I
Helper I

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
Highlighted
Dual Super User III
Dual Super User III

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!



Highlighted
Helper I
Helper I

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?

Highlighted
Dual Super User III
Dual Super User III

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
Helper I
Helper I

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

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

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