# 24 hour time calculator

After entering a time in 24-hour format, this calculator lets you add and subtract a period to give a new time, also in 24 hour format. The 24 hour time format is also known as "military time".

For example, you could enter the time 15:00:00 (3 pm), then add 70 seconds to it which would give 15:01:10 ( 3:01 and 10 seconds pm).

 : : Hours Mins Secs

## Instructions

The calculator adds or subtracts input durations from the time in the top window. You first enter a time in 24 hour format For example 6:12:0 which is read as 6 hours 12 minutes and zero seconds. (6:12 am). After that you enter durations and add/subtract them from the time in the top window.

• Enter a time in three parts: the hours in left field, minutes in the middle, and seconds in the right field. When entering a time, the calculator checks that the hours are in the range 0-23, minutes and seconds are in the range 0-59.
• Enter the time by pressing "Enter a time". The time is placed in the top window, replacing what was there.
• Enter a duration in the the three input boxes. The inputs can be any positive number. For example you could enter 100 in the minutes box and press "+". This would add 100 minutes to the time and display the new time. The numbers can have decimal places. For example 3.5 minutes will be taken as 3 min 30 sec.

## How it works

When a time is entered, it is internally converted to the number of seconds past midnight. When a duration is entered (For example: 2 hrs 8 mins) the duration is converted to seconds. The addition / subtraction is performed on the seconds and then the result formatted as a new 24 - hour time.

If the operation results in a time in another day, the number of days offset from the original time input is also shown.

For example if you enter 3:00:00 and then subtract 4 hours, it will show the result as

"23:00:00 Previous day"
meaning 11pm the day before the original time you entered.

The calculator shows midnight as 00:00:00, and assumes that to be the beginning of a day. It will never display 24:00:00. So for example

• 00:00:00 + 8 hours = 8 o'clock in the morning on the same day
• 10:00:00 – 10 hours is 00:00:00 on the same day
• 23:59:59 + 1 second = 00:00:00 on the next day