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 / Date DIfference in min...
Power Automate
Unanswered

Date DIfference in mins, hrs and days

(0) ShareShare
ReportReport
Posted on by 517

Hello,

I'm trying to create a TAT based on date difference and i wanted to display in mins, hrs and days...

Here's the formula i used

 

Mins

div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),600000000)

Hrs

div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')), ticks(body('LAST_APPROVAL_DATE'))), 36000000000)

Days:

div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')), ticks(body('LAST_APPROVAL_DATE'))), 864000000000)

 

jaina_1-1670815652864.png

and Here's the output data. How can I achieve to get the correct mins, hrs and days, say in below example, the result should be

from 0 days, 1 hrs, 78 mins to 0 days, 1 hrs, 18 mins and from 0 days, 1 hrs, 81 mins to 0 days, 1 hrs, 21 mins.

 

 

jaina_0-1670815462845.png

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    The DateDifference function will give you the difference between two dates in Days, hours, minutes, seconds formatted as days.hours:minutes:seconds.  You can then take that string and split it into an array to get the individual days, hours, minutes etc.  You can read about it here: Reference guide for expression functions - Azure Logic Apps | Microsoft Learn

  • Verified answer
    v-liwei-msft Profile Picture
    on at

    Hi @jaina 

     

    You can try

    As for minutes:

     

    if(lessOrEquals(div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),600000000),60),div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),600000000),mod(div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),600000000),60))

    As for hours:

    if(lessOrEquals(div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),36000000000),24),div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),36000000000),mod(div(sub(ticks(body('AUTOMATION_COMPLETION_DATE')),ticks(body('LAST_APPROVAL_DATE'))),36000000000),24))

     

     

     

    Best Regards,

    Levi

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
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard