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

@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

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

@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

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

@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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,881)