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

Announcements

News and Announcements icon
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,981 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 86 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 55

#3
Ellis Karim Profile Picture

Ellis Karim 53 Super User 2026 Season 1

Last 30 days Overall leaderboard