cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Expression to subtract the date of "created on" from current time

Hello,
I have created a flow that will filter all the active cases in an entity and display them in an HTML table.

What I want to achieve is the following:

  • I would like to subtract the UTC now() date and the date that the case was created on.
    The default column expression of "Created on" column is the following:

Capture.PNG

Capture.PNG

  • Besides, after the estimation is completed I want to concatenate to the result, "Day" if it's less than one, and Days if it's greater than one.

What could be the expression for this scenario?
Can please someone provide an example?

 

Any help will be greatly appreciated.
Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @Julien2 

 

Thanks for the screen share.

 

The below expression will give you the number of days.

div(sub(ticks(formatDateTime(utcNow(),'yyyy-MM-dd')),ticks(formatDateTime(items('Apply_to_each')?['createdon'],'yyyy-MM-dd'))),864000000000)
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

3 REPLIES 3
Resolver II
Resolver II

Hello @Julien2 

 

You can use the expression: 

addDays(utcNow(),-7,'dd/MM/yyyy')
 
This will subtract 7 days off today's date, for you pre-defined date you would replace utcNow() with your field.
 
Hope this helps 🙂
 
Thanks

Bradley
Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more
Super User III
Super User III

Hi @Julien2 

 

Thanks for the screen share.

 

The below expression will give you the number of days.

div(sub(ticks(formatDateTime(utcNow(),'yyyy-MM-dd')),ticks(formatDateTime(items('Apply_to_each')?['createdon'],'yyyy-MM-dd'))),864000000000)
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

Hello @abm,

 

Thank you very much for your support!

 

Regards,

Julien

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (19,068)