cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CPKH
Helper I
Helper I

Two labels with Text, source to calculate worktime-pause "hh:mm"

Hey all again!

I have two labels with Text. For example "03:16" and "00:06".

Now i want to calculate A-B="03:10". How i can do this?

I want to calculate with the Result too. In further functions i want to sum all worktime of a week.

 

I want to build a little Timetracker. Calculate with date and time oder sharepoint is really horrible 😞

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @CPKH 

The following function will provide the difference in minutes between the 2 times. In this example, the result will be 190.

DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes)

In your case, you can refer to your labels, rather than use hardcoded values.

You can then use this with the formula in your other post to display the duration in hh:mm format.

 

RoundDown(DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes)/60,0) & 
":" & 
Text(Mod(DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes),60), "00") 

If you post some additional details about your summing requirements, we can provide some more specific help.

View solution in original post

4 REPLIES 4
timl
Super User
Super User

Hi @CPKH 

The following function will provide the difference in minutes between the 2 times. In this example, the result will be 190.

DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes)

In your case, you can refer to your labels, rather than use hardcoded values.

You can then use this with the formula in your other post to display the duration in hh:mm format.

 

RoundDown(DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes)/60,0) & 
":" & 
Text(Mod(DateDiff(TimeValue("00:06"),TimeValue("03:16"), Minutes),60), "00") 

If you post some additional details about your summing requirements, we can provide some more specific help.

It works perfectly! thanks!

Could u answer me, why we have to use mod() for the minutes "00:XX". I don't undertstand that part.

I was confused... i first tried

TimeValue("00:06") and thats "12:06 AM"

So i thought i cannot take it, because now its a real time and not just a number in a time format i can calculate with.

Thats all at the moment, thanks for your help!

Hi @CPKH 

Glad that works for you.

The Mod function returns the remainder after the division of 2 numbers.

Taking the example of 190 minutes...

Mod(190, 60) = 10

60 goes into 190 3 times, with 10 left over. This 10 value provides us with the minute component of 03:10.

Hope that makes sense to you!

Ah! Yes, makes it 🙂 Thanks @timl !

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,087)