cancel
Showing results for
Did you mean:
Helper I

## Convert number and format hour(00:00) and sum two types of hours

hello

How it converts number into hours? After that I want sum with another number hour format.

Example: (2000/5500)*60=21,81  It"s 21 minutes and 81 second, I want to format 00:21. After that I want to sum whith(Example) 10:00+00:21=10:21. I need this result.

Thank you

2 ACCEPTED SOLUTIONS

Accepted Solutions
Helper I

It worked very well 👏👏

Thank you very a lot

Super User

No problem.

Then change this line in the formula:

``Text(_hours, "[\$-en-US]00") & ":" & Text(Mod(_minutes, 60),"[\$-en-US]00")``

To this:

``Text(Mod(_hours, 24), "[\$-en-US]00") & ":" & Text(Mod(_minutes, 60),"[\$-en-US]00")``

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
16 REPLIES 16
Super User

Set the text property of a label to the following:

``````With({_seconds:((2000/5500)*60) + (10*3600) },
Round(_seconds/3600, 0) & ":" & Text(Mod(_seconds, 3600), "[\$-en-US]00")
)``````

In the above formula, the first part of the equation ((2000/5500)*60) provides the 21 minutes and 81 seconds.  The second part (10*3600) adds 10 minutes to that.

The text part will round the minutes and then the second text part returns the mod to provide the minutes.

Note: in your example, normally 21.81 seconds would considered 22 seconds when rounded.  The above does that.  If you need to remove the fractions of a second, then adjust the formula as necessary. i.e.
(RoundDown((2000/5500)*60, 0)) + (10*3600)

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Helper I

Thank you @RandyHayes

I’ll describe my problem better

Label3 = 2000(production measured)

Label5_1=5500(production of parts per hour)

label7,  I put the function below, that you mentioned

With({_seconds:((Label3.Text/Label5_1.Text)*60)+(10*3600)};Round(_seconds/3600;0)& ":" & Text(Mod(_seconds; 3600);"[\$-en-US]00"))

Result(production time required) = 10:22, but the result should be 00:22 minutes(rounded)

After that  I would like to add result 00:22

Label 4 =10:00 + Label 7= 00:22

Label 8 =10:22( Final result)

Super User

I believe you were missing the fact that I put the 10 into the calculation to emphasize that we were adding 10 hours to the formula to show that was the place to do it.

I will write the formula a little different so you can see the breakout of where things are used in the formula:

``````With({_productionMeasured : Value(Label3.Text);
_productionPPH : Value(Label5_1.Text);
};

Round(_seconds/3600;0)& ":" & Text(Mod(_seconds; 3600);"[\$-en-US]00")
)
)``````

So, you could use the above formula in the Text property of Label8 and you could use the same formula in Label7 except change the Value(Label4.Text) in the formula to 0

I hope that is clearer.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Helper I

It works, but when the result is greater than 60 minutes I woud like that result were 01:00.

Example below:

01:08( hour format)

Super User

I'm a little confused.  The formula I gave you was in hh:mm format.

In the original, we added 10 hours to the 22 second result (and I apologize now looking back at the formula that I named things wrong, but the outcome was what was expected).  10 hours and 22 minutes

So your display showed "10:22" for 10 hours 22 minutes.

You should have never seen a "0:68" - what is your formula looking like at this point that got you that?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Helper I

Look at this,

Model app

Math calculations

6000/5600=1,0714(Change for a minutes)*60=64 minutes

(piece for produce/Produce for hour)*60=produce time

I need to sum beggining time and produce time

Result 11:00 (End of production)

Helper I

I used your instruction but It didn't work corretly. Look this result.

Result 01:17, not 0:77

Sum It 10:00+01:17 result ia 11:17. Did you understand?

Super User

Yes, there was a overflow of minutes and hours in the previous formula.

``````With({_productionMeasured : Value(Label13.Text),
_productionPPH : Value(Label15_1.Text),
_minutesToAdd : With({_tval: TimeValue(Label12.Text)}, Hour(_tval)*60 + Minute(_tval))
},

With({_minutes:Round((_productionMeasured/_productionPPH)*60, 0) + _minutesToAdd  },
With({
_hours:RoundDown(_minutes/60, 0)
},

Text(_hours, "[\$-en-US]00") & ":" & Text(Mod(_minutes, 60),"[\$-en-US]00")
)
)
)``````

ALSO....DO NOT replace the items in the With formula with things like Label13.Text  Use this formula as it is.  You cannot rely on PowerApps to convert text to numeric and you also will not get any value trying to take the text of "10:00".

So, leave the inner formula the way that it is - in other words things like:

_minutes:Round((_productionMeasured/_productionPPH)*60, 0) + _minutesToAdd

should be left as they are, do not put your labels in this formula as you showed in your picture.  The With function is already taking that into account.  If you need to change names of label controls, ONLY do it in the With signature.

Using the values of your picture I get (sorry no labels, but the same values):

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Helper I

I did what you asked, it seems that this did not add up with the calculated result

Note that if I change the production start to 11:00(Below), the result also changes to 11:00.

It doesn’t seem to be adding up

Announcements

#### A Celebration of What We've Achieved--And Announcing Our Winners

As the sun sets on the #SummerofSolutions Challenge, it's time to reflect and celebrate! The journey we embarked upon together was not just about providing answers – it was about fostering a sense of community, encouraging collaboration, and unlocking the true potential of the Power Platform tools.   From the initial announcement to the final week's push, the Summer of Solutions Challenge has been a whirlwind of engagement and growth. It was a call to action for every member of our Power Platform community, urging them to contribute their expertise, engage in discussions, and elevate collective knowledge across the community as part of the low-code revolution.   Reflecting on the Impact As the challenge ends, it's essential to reflect on the impact it’s had across our Power Platform communities: Community Resilience: The challenge demonstrated the resilience of our community. Despite geographical distances and diverse backgrounds, we came together to contribute, learn, and collaborate. This resilience is the cornerstone of our collective strength.Diverse Expertise: The solutions shared during the challenge underscore the incredible expertise within our community. From intricate technical insights to creative problem-solving, our members showcased their diverse skill sets, enhancing our community's depth.Shared Learning: Solutions spurred shared learning. They provided opportunities for members to grasp new concepts, expand their horizons, and uncover the Power Platform tools' untapped potential. This learning ripple effect will continue to shape our growth. Empowerment: Solutions empowered community members. They validated their knowledge, boosted their confidence, and highlighted their contributions. Each solution shared was a step towards personal and communal empowerment. We are proud and thankful as we conclude the Summer of Solutions Challenge. The challenge showed the potential of teamwork, the benefit of knowledge-sharing, and the resilience of our Power Platform community. The solutions offered by each member are more than just answers; they are the expression of our shared commitment to innovation, growth, and progress!   Drum roll, Please... And now, without further ado, it's time to announce the winners who have risen above the rest in the Summer of Solutions Challenge!   These are the top community users and Super Users who have not only earned recognition but have become beacons of inspiration for us all.   Power Apps Community:  Community User Winner: @SpongYe Super User Winner: Pending Acceptance Power Automate Community:  Community User Winner: @trice602 Super User Winner: @Expiscornovus  Power Virtual Agents Community: Community User Winner: Pending AcceptanceSuper User: Pending Acceptance Power Pages Community: Community User Winner: @OOlashyn Super User Winner: @ChristianAbata   We are also pleased to announced two additional tickets that we are awarding to the Overall Top Solution providers in the following communities:    Power Apps: @LaurensM   Power Automate: @ManishSolanki    Thank you for making this challenge a resounding success. Your participation has reaffirmed the strength of our community and the boundless potential that lies within each of us. Let's keep the spirit of collaboration alive as we continue on this incredible journey in Power Platform together.Winners, we will see you in Vegas! Every other amazing solutions superstar, we will see you in the Community!Congratulations, everyone!