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
Super User
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

 

 





If anybody solved your question, remember to mark its post as a solution!

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

Thanks @efialttes,

 

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

formatDateTime(addDays(triggerBody()['ConfirmationDateBanks0'],366),'yyyy-MM-dd')
4 REPLIES 4
Super User
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





If anybody solved your question, remember to mark its post as a solution!

Proud to be a Flownaut!





Highlighted
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?

Super User
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

 

 





If anybody solved your question, remember to mark its post as a solution!

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

Thanks @efialttes,

 

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

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow 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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 106 members 4,497 guests
Recent signins:
Please welcome our newest community members: