**Adding or subtracting time – Algorithm 2**.

*Previous algorithm is described here: Adding Time*

Are you looking for

**adding time calculator** online? See our online tool :

Hour Calculator
Step 1 – Convert your data (time) to the smallest unit (minutes or seconds)

Step 2 – Add the values received in Step 1

Step 3 – Convert obtained result back to the desired format

**Comments:**

Step 1

“The smallest unit” means that if your data is given without seconds,e.g. 2:10 (two hours, ten minutes),

there is no need to convert hours to seconds because the smallest unit is a minute.

How to convert minutes to seconds, hours to minute and hours to seconds?

To convert minutes to seconds, simply multiply number of minutes by 60 (there is 60 seconds in one minute).

To convert hours to minutes, multiply number of hours by 60 (there is 60 minutes in an hour).

To convert hours to seconds multiply number of hours by 3600 (there is 60 seconds in each minute and 60

minutes in each hour, so 60*60 = 3600)

Step 2

no comments needed, I hope. This is simple arithmetic addition (or subtraction)

Step 3

This is the hardest step of this algorithm. To perform minutes to hours or

seconds to minute conversion, we have to find quotient (integer part) and reminder (‘left over’ amount)

of the division by 60 (or 3600). How to calculate quotient and reminder – see examples.

**Example 1**

T1 = 10:20, T2 = 1:50 – both values could be minutes:seconds or hours:minutes but let’s assume hours and minutes.

Step 1 – Change hours and minutes to minutes (smallest unit is minute):

T1 = 10:20 = 10*60 + 20 = 620 minutes

T2 = 1:50 = 1*60 + 50 = 110 minutes

Step 2 – Adding:

T1 + T2 = 620 + 110 = 730 minutes

Step 3 – Change minutes to hours and minutes:

To convert minutes into hours and minutes, we have to divide number of minutes by 60 (number of minutes in one hour)

730/60 => quotient = 12, reminder = 10

How to calculate the quotient?

Simply, divide the numbers and throw decimal part away (730/60 = 12.16666…, so the quotient is 12)

How to calculate the reminder?

Simply, multiply quotient by divisor (12*60) and subtract obtained result from the divident (730 – 720 = 10)

or multiply thrown away decimal part by the divisor (60*0.166666… = 10)

The answer is 12 hours and 10 minutes (You can check the result using Hour Minute Calculator)

**Example 2** (dealing with hours, minutes and seconds)

T1 = 10:20:25, T2 = 1:50:45

Step 1 – Converting hours, minutes and seconds to seconds (smallest unit is second):

T1 = 10:20:25 = 10*60*60 + 20*60 + 25 = 36000 + 1200 + 25 = 37225 seconds

T2 = 1:50:45 = 1*60*60 + 50*60 + 45 = 3600 + 3000 + 45 = 6645 seconds

Step 2 – Adding:

T1 + T2 = 43870 seconds

Step 3 – Converting seconds to hours, minutes and seconds:

Method 1 – finding number of hours and seconds first.

43870/3600 => quotient = 12, reminder = 670 (how to find quotient and reminder – see Example 1)

So, we get 12 hours and 670 seconds. 670 seconds equals to 11 minutes and 10 seconds (why? – try to guess :))

So, the answer is 12 hours, 11 minutes and 10 seconds.

Method 2 – finding number of minutes and seconds first.

43870/60 => quotient = 731, reminder = 10

that means, we have 731 minutes and 10 seconds. 731 minutes is equal to 12 hours and 11 minutes

(how to convert minutes into hours and minutes – see example 1)

So, method 2 gives us the same result: 12 hours, 11 minutes, 10 seconds. (Check the result using Hour Minute Second Calculator)

Notice, that in the algorithm described above there is almost no difference between adding and subtracting.

The only difference can be found in step 2 and it is simple arithmetic calculation.