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 / Calculating Total Time...
Power Apps
Answered

Calculating Total Time From Two ComboBoxes

(0) ShareShare
ReportReport
Posted on by 1,059

Hi,

 

I have two Combo Boxes, Names: TimeOffFrom, TimeOffTo

In which user will Select a value from the two Combobox (dropdowns), after that I want to show the total time requested in a Label,

I have values like this:
Combobox1 : 9:00 AM, 9:30 AM, ....,12:00 PM,.. 5:00 PM

Combobox2 : 9:00 AM, 9:30 AM, ....,12:00 PM,.. 5:00 PM

I want to show in the Label like this:
2 - Hours, 3 - Hours etc 

Check ScreenShots
Menu.jpgtotalTime.jpg

Label should show : 1 - Hour as from 10:00 AM to 11:00 AM

Thanks

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @MH3 
    I assume your ComboBox values are text strings rather than actual time objects.  Please use this code in the Text property of a label to display the hours difference.

    DateDiff(TimeValue(ComboBox1.Selected.Value), imeValue(ComboBox2.Selected.Value), Hours)

     

    If your ComboBox values are actual Time objects you can use this shorter code.

    DateDiff(ComboBox1.Selected.Value, ComboBox2.Selected.Value, Hours)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • MH3 Profile Picture
    1,059 on at

    Hi @mdevaney ,

     

    The formula worked, but there are some issues, it works when I select 1 hour difference between the two times.

    but when I select like this, check ScreenShots

    1) Scenario It should show 3:30  Hours

    time.jpg

    2) Scenario it should show 00:30 Hours
    Time3.jpg

     

    The Minute difference is not shown here, how to fix your code according to this?

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 96 Super User 2026 Season 1

Last 30 days Overall leaderboard