- Power Apps Community
- Welcome to the Community!
- News & Announcements
- Get Help with Power Apps
- Building Power Apps
- Microsoft Dataverse
- AI Builder
- Power Apps Governance and Administering
- Power Apps Pro Dev & ISV
- Power Apps Portals
- Connector Development
- Power Query
- GCC, GCCH, DoD - Federal App Makers (FAM)
- Power Platform Integration - Better Together!
- Power Platform Integrations
- Power Platform and Dynamics 365 Integrations
- Community Blog
- Power Apps Community Blog
- Galleries
- Community Connections & How-To Videos
- Community App Samples
- Webinars and Video Gallery
- Canvas Apps Components Samples
- Kid Zone
- Emergency Response Gallery
- Events
- 2021 MSBizAppsSummit Gallery
- 2020 MSBizAppsSummit Gallery
- 2019 MSBizAppsSummit Gallery
- Community Engagement
- Community Calls Conversations
- Experimental
- Error Handling
- Power Apps Experimental Features
- Community Support
- Community Accounts & Registration
- Using the Community
- Community Feedback

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Power Apps Community
- Forums
- Get Help with Power Apps
- Building Power Apps
- Re: Convert number and format hour(00:00) and sum ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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

01-09-2021
09:47 AM

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

Solved! Go to Solution.

2 ACCEPTED SOLUTIONS

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-18-2021
03:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-19-2021
05:22 PM

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!**

NOTE: My

Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

16 REPLIES 16

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-09-2021
10:42 AM

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!**

NOTE: My

Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-10-2021
06:59 AM

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)**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-11-2021
06:43 AM

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);
_hoursToAdd : Value(Label4.Text)
};
With({_seconds:((_productionMeasured/_productionPPH)*60)+(_hoursToAdd * 3600)};
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!**

NOTE: My

Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-12-2021
01:59 PM

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)**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-12-2021
03:12 PM

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?

NOTE: My

Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-12-2021
04:52 PM

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)**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-16-2021
06:55 PM

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-17-2021
11:57 AM

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

Use this instead:

```
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):

NOTE: My

Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

01-17-2021
12:51 PM

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

Top Kudoed Authors

User | Count |
---|---|

260 | |

123 | |

99 | |

48 | |

43 |