cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dennisb88
Resolver I
Resolver I

Calculate between two dates

Hi all,

 

I've a question:

In my flow I got a SharePoint Item that  has dates in a text column stored with the dd-MM-yy format.

I need to calculate how much days there are between the date that stored in the SharePoint item and the current date.
To achieve that, I've the follow steps in my flow:

dennisb88_0-1614109655523.png

 

But the set variable action is failed. I use the expression below: 

 

 

div(sub(ticks(outputs('Compose_3')),ticks(outputs('Get_item')?['body/Datum'])),864000000000)

 

 
The error that I've:
 

 

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '11644': 'In function 'ticks', the value provided for date time string '23-02-21' was not valid. The datetime string must match ISO 8601 format.'.

 

 

I'm not able to change the data format in the SharePoint list because it's part of a complex PowerApp, so I'm hoping someone know how to count between the current date and the date that's set in the text column in SharePoint.

 

Looking forward to suggestions.

Kind regards,

Dennis

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @NWEASD ,

 

Thank you for your reply.

Unfortunately it gives me the same error:

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '11644': 'In function 'formatDateTime', the value provided for date time string '23-02-21' was not valid. The datetime string must match ISO 8601 format.'.

 

But for now I don't need help anymore on this issue, My end goal was to delete all items that are older or equal to the current date. To achieve that I've create a new flow that's run every day with a filter on the "datum" column and delete al found items.

 

Thanks again and have a nice day.

View solution in original post

2 REPLIES 2
NWEASD
Helper III
Helper III

Have you tried the formateDateTime command.  This should not change the date on the sharepoint end and just for the function.

 

div(
	sub(
		ticks(
			formatDateTime(outputs('Compose_3'), 'yyyy-MM-dd')
		),
		ticks(
			formatDateTime(outputs('Get_item')?['body/Datum'], 'yyyy-MM-dd')
		)
	),
	864000000000
)

I just added the spaces to confirm that I had all of the parenthesis closed.

Hi @NWEASD ,

 

Thank you for your reply.

Unfortunately it gives me the same error:

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '11644': 'In function 'formatDateTime', the value provided for date time string '23-02-21' was not valid. The datetime string must match ISO 8601 format.'.

 

But for now I don't need help anymore on this issue, My end goal was to delete all items that are older or equal to the current date. To achieve that I've create a new flow that's run every day with a filter on the "datum" column and delete al found items.

 

Thanks again and have a nice day.

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (78,467)