web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Subtracting between da...
Power Automate
Answered

Subtracting between dates using sub and subtractFromTime

(0) ShareShare
ReportReport
Posted on by 248

Hello forum.  The forum has been a lifesaver.  So thank you.

 

I am created a flow that checks a SP list for any item that is 30 days from the Expire date (date column in SP).  At 30 days, the flow sends out a notification.  Within the  notification,  I want to have the flow calculate the number of days that the item has been active.  This would be accomplished by taking the current date and subtracting the Created date.  I have tried different expression formulas without success.  

 

-- sub(formatDateTime(utcNow(), 'yyyy-MM-dd'),formatDateTime(items('Apply_to_each_2')?['Created'], 'yyyy-MM-dd')) <-- states that the 1st parameter is a string even after formatting

 

-- subtractFromTime(formatDateTime(utcNow(), 'yyyy-MM-dd'),formatDateTime(items('Apply_to_Each_2')?['Created'],'yyyy-MM-dd'),'Day')

 

-- subtractFromTime(utcNow(),items('Apply_to_Each_2')?['Created'],'Day')

 

Tried variations of the above formulas and have not been successful.  I also tried creating variables and using the Compose action without success.

 

Any ideas?

 

Thanks again for this forum!!  and hope everyone has a safe and wonderful holiday season.

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,928 Most Valuable Professional on at

    Hi Misa,

     

    Yes this community is fantastic. Thanks for the kind words.

     

    To find the days between two dates please use the below expression

     

    div(sub(ticks(formatDateTime(utcNow(),'yyyy-MM-dd')),ticks(items('Apply_to_each_2')?['Created'])),864000000000)
     
    If you need any further help please let me know.
     
    Thanks
     
     
  • Misa Profile Picture
    248 on at

    @abm 

     

    Thank you so much!  It worked perfectly!!!  I started doing the happy dance.  😄 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Expiscornovus Profile Picture

Expiscornovus 201 Most Valuable Professional

#2
David_MA Profile Picture

David_MA 174 Super User 2025 Season 2

#3
harshdeol Profile Picture

harshdeol 167 Moderator

Last 30 days Overall leaderboard