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 Apps / how do you take two 24...
Power Apps
Answered

how do you take two 24 hr time values and return a decimal number representing minutes. Example 15:

(0) ShareShare
ReportReport
Posted on by 44

I have three input boxes Start, End and TotalTime each box would receive 24 hr time values with just hours and minutes.  I would like the TotalTime input box to contain the time difference between Start and End, but, in a decimal format.  As an example the Start time is 15:00 and the End time is 15:20.  The TotalTime input box should calculate to .3 not 00:20.  Do I have to convert text to time the reduce the value to seconds.  An example formula would be great.  Most examples I have found only return the value as minutes and seconds as 00:20.

Categories:
I have the same question (0)
  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    If you have the times you want to calculate as text (e.g., in text input controls), then you will need to convert them to time, using the TimeValue function. If you have two time values, you can subtract them, and you will have the result in milliseconds:

    ForumPost-001.png

    You can also convert the result to have the result in any of the units you want. For the difference in seconds:

    ForumPost-002.png

    Or in  minutes:

    ForumPost-003.png

    Or in hours, as I believe your example requires:

    ForumPost-004.png

    Based on the example in your question, if you want to display that difference with less decimal places, you can use the Text function to format that number as needed:

    ForumPost-005.png

    Notice that if one of the values is not valid you may end up with an invalid difference, like in the example below

    ForumPost-006.png

    To prevent that you may want to consider using a control that restricts the values that the user can enter, such as dropdown boxes.

  • roknron Profile Picture
    44 on at

    That worked, but, I had to make each of the timevalues negative numbers as Text((-TtimeValue(DatacardValue5.Text) -                    -Timevalue(DatacardValue4.Text)) / 1000 / 60 / 60, "0.0).  What's up with that?

  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    Try reversing the order in which the parameters are subtracted, then you should get the value you want:

    Text(
     (TimeValue(DatacardValue4.Text) - Timevalue(DatacardValue5.Text)) / 1000 / 60 / 60,
     "0.0")

    In case, if the value of DatacardValue4.Text is after the value of DatacardValue5.Text, then the value will be positive.

     

    If you want the absolute difference between the two values (regardless of which one is the earlier time), you can use the Abs function to get that value:

    Text(
     Abs((TimeValue(DatacardValue4.Text) - Timevalue(DatacardValue5.Text)) / 1000 / 60 / 60),
     "0.0")

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard