The way to do it is similar to the way that you add and subtract regular numbers, with “borrowing” or “carrying” numbers between the hours and seconds.

For adding times together, you first add the minutes together. If that number is over 60, you subtract 60 from it and carry a 1 into adding the hours. Then, when you add the hours together, you see if that number is greater than 12. If it is, then you subtract 12 from it and change am to pm, or vice versa. If you were calculating a duration, then you carry the 1 into the days part. If you were just calculating a time of day, you can just drop the one.

For subtracting, you first subtract the minutes. If the top number is less than the bottom number, you first borrow an hour from top number, reducing that number by 1. Once you’ve borrowed 1, you then add 60 to the top number, and then do the subtraction. Then, you go over to the hours part and subtract those numbers. If the top number is less than the bottom number, then you add 12 and change am to pm or vice versa.

One thing I’d like to point out is the difference between a *time of day* and a *duration*. You can’t add two time of days together, if you add a time of day to a duration then you get a time of day, and if you add two durations together then you get another duration. Similarly, you can’t subtract a time of day from a duration, if you subtract a time of day from a time of day you get a duration, if you subtract a duration from another duration you get a duration, and if you subtract a duration from a time of day, you get a time of day.

For instance, let’s day that you want to find the time that is 4 hours, 25 minutes before 2:15pm.

```
2:15 pm
- 4:25 duration
-------------------
??:?? pm
```

- Subtract 25 from 15. Since 15 < 25, you’ll have to borrow 1 from the hours column and add 60 to the minutes column:

```
1:75 pm
- 4:25 duration
-------------------
??:50 pm
```

- Subtract 4 from 1. Since 1 < 4, you’ll add 12 to the time of day and change pm to am:

```
13:75 am
- 4:25 duration
-------------------
9:50 am
```

So 4 hours and 25 minutes before 1:25 pm is 9:50 am.