# 24 hour time conversion

**URL:** <https://boards.straightdope.com/t/24-hour-time-conversion/292059>\
**Category:** Factual Questions\
**Created:** [February 26, 2005, 10:53pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059 "2005-02-26T22:53:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ficer67](https://avatars.discourse-cdn.com/v4/letter/f/c57346/32.png) [@Ficer67](https://boards.straightdope.com/u/Ficer67)\
**Post date:** [February 26, 2005, 10:53pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/1 "2005-02-26T22:53:55Z")

</div>

Someone once told me there was a trick to converting from 24 hour time to 12 hour time. Does anyone know this trick?

---

<div class="post-metadata">

**Author:** ![robby](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/robby/32/11048_2.png) [@robby](https://boards.straightdope.com/u/robby)\
**Post date:** [February 26, 2005, 11:00pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/2 "2005-02-26T23:00:50Z")

</div>

If the time is greater than 1200, subtract 12 from the hour.

No real trick–were you thinking of something else? 😕

---

<div class="post-metadata">

**Author:** ![Ficer67](https://avatars.discourse-cdn.com/v4/letter/f/c57346/32.png) [@Ficer67](https://boards.straightdope.com/u/Ficer67)\
**Post date:** [February 26, 2005, 11:05pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/3 "2005-02-26T23:05:18Z")

</div>

Ok, well I already knew how to convert from 24 hour time to 12 hour time, but I have been informed that there is a shortcut that allows people to do the math faster. And that is what I am interested in. So does anyone know this shortcut?

---

<div class="post-metadata">

**Author:** ![mhendo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mhendo/32/3159_2.png) [@mhendo](https://boards.straightdope.com/u/mhendo)\
**Post date:** [February 26, 2005, 11:10pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/4 "2005-02-26T23:10:09Z")

</div>

Exactly what “shortcut” could there be to subtracting 12 from something?

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [February 27, 2005, 12:29am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/5 "2005-02-27T00:29:26Z")

</div>

The only way it could be faster is if times were expressed in base twelve. In that case, you could erase the leading 1 and write “PM” afterwards.

---

<div class="post-metadata">

**Author:** ![Chefguy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chefguy/32/138_2.png) [@Chefguy](https://boards.straightdope.com/u/Chefguy)\
**Post date:** [February 27, 2005, 12:40am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/6 "2005-02-27T00:40:08Z")

</div>

Yes! Subtract 14 and then add 2.

Hey, it was a good running joke on my old girlfriend for about six months.

---

<div class="post-metadata">

**Author:** ![GreyWanderer](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@GreyWanderer](https://boards.straightdope.com/u/GreyWanderer)\
**Post date:** [February 27, 2005, 12:40am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/7 "2005-02-27T00:40:33Z")

</div>

I don’t know if it can be called a trick, but I used to remove the 1 and substract 2 from the remaining number. Like 15.00 is 5 - 2 = 3pm.

If you live in country that used the 24 four hour system you’re so used to it anyway, so when you see 15.00 you just instantly think 3 o’clock.

---

<div class="post-metadata">

**Author:** ![Richard\_Pearse](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/richard_pearse/32/13144_2.png) [@Richard\_Pearse](https://boards.straightdope.com/u/Richard_Pearse)\
**Post date:** [February 27, 2005, 2:59am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/8 "2005-02-27T02:59:15Z")

</div>

> [@GreyWanderer](#):
>
> I don’t know if it can be called a trick, but I used to remove the 1 and substract 2 from the remaining number. Like 15.00 is 5 - 2 = 3pm.

This is what I do. Of course this is identical to subtracting 12, it’s just an easy way of thinking about it.

I used to have a little more trouble converting from UTC to local time when local time was UTC + 9.5. Sure you just add 9.5 but when it’s 3 in the morning and you’re trying to mentally confirm what time you’re supposed to get up for work and you’re going, “ok I’m taking off at 2130UTC which is… ummm add the 9 is 3030… minus the 2400 is… umm 0630… now add the .5 (or did I do that?) nope, 0700 then, now I have to be there an hour and a half before that so … that’d be 0500 so I gotta get up at 0400! Did I do that right? Lets just check it…”

---

<div class="post-metadata">

**Author:** ![Merkwurdigliebe](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Merkwurdigliebe](https://boards.straightdope.com/u/Merkwurdigliebe)\
**Post date:** [February 27, 2005, 2:37pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/9 "2005-02-27T14:37:55Z")

</div>

haha, well, I doubt there is any kind of trick. I do something sometimes that might be considered a trick, but probably not. Just look at the time. when it’s 8 PM it will be 20. But you see it’s that 2 in the 12 that throws you off. But all you really need to do is to subtract 2 to get an idea of what time it is. Subtract two from twenty and you get 18. Obviously this isn’t right, but it lets you mentally lop off that one to the side.

That’s about as close to a shortcut as I think you can get…

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [February 27, 2005, 4:00pm UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/10 "2005-02-27T16:00:26Z")

</div>

Have our arithmetic skills really gotten so bad that we can’t subtract 12 anymore?

---

<div class="post-metadata">

**Author:** ![Lumpy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lumpy/32/446_2.png) [@Lumpy](https://boards.straightdope.com/u/Lumpy)\
**Post date:** [February 28, 2005, 12:30am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/11 "2005-02-28T00:30:37Z")

</div>

Is there a conversion algorithm that, _without_ using an **IF Hour\>12** operation, you can plug the hours value into and always get a valid result?

---

<div class="post-metadata">

**Author:** ![Fuji\_Kitakyusho](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@Fuji\_Kitakyusho](https://boards.straightdope.com/u/Fuji_Kitakyusho)\
**Post date:** [February 28, 2005, 1:07am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/12 "2005-02-28T01:07:46Z")

</div>

> [@Lumpy](#):
>
> Is there a conversion algorithm that, _without_ using an **IF Hour\>12** operation, you can plug the hours value into and always get a valid result?

Divide hours by twelve in quotient/remainder format, pass only the remainder.

---

<div class="post-metadata">

**Author:** ![Nanoda](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Nanoda](https://boards.straightdope.com/u/Nanoda)\
**Post date:** [February 28, 2005, 1:48am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/13 "2005-02-28T01:48:13Z")

</div>

> [@Lumpy](#):
>
> Is there a conversion algorithm that, _without_ using an **IF Hour\>12** operation, you can plug the hours value into and always get a valid result?

[Mod](http://www.cut-the-knot.com/blue/Modulo.shtml)?

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://boards.straightdope.com/u/eagle)\
**Post date:** [February 28, 2005, 2:23am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/14 "2005-02-28T02:23:16Z")

</div>

> [@Ficer67](#):
>
> Someone once told me there was a trick to converting from 24 hour time to 12 hour time. Does anyone know this trick?

Oh boy, such a simple question, so many answers, and none is correct.

**Robby** : 12:00 is 12:00 pm, but 0:00 is 12:00 pm. How does this fit your “easy” greater than 12 subtract 12 rule? (Hint: there is no such time as 24:00)

**ultrafilter** : 0:00 in duodecimal notation is still 0:00, yet it is PM. How does this apply your rule of removing the 1 and writing PM for it?

**GreyWanderer** : In 0:00 there is no 1 to remove, yet it still is 12:00 am. So what is your rule worth?

Here is the correct conversion table:

24 hour format = am/pm 12 hour format:

0:00 - 0:59 = 12:00 am - 12:59 am  
1:00 - 11:59 = 1:00 am - 11:59 am  
12:00 - 12:59 = 12:00 pm - 12:59 pm  
13:00 - 23:59 = 1:00 pm - 11:59 pm

And a remark to those thinking in programming languages: It is “IF (Hour24 \< 12) THEN AM else PM” and “if (Hour24 == 0) then Hour12=12 else if (Hour24 \> 12) then Hour12 = Hour24 - 12 else Hour12 = Hour24”. There is no easy way to do this with “mod”.

cu

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://boards.straightdope.com/u/eagle)\
**Post date:** [February 28, 2005, 2:28am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/15 "2005-02-28T02:28:32Z")

</div>

Sorry, it is late night here in Germany (3:44 AM), so I made errors:

**Robby** : 12:00 is 12:00 pm, but 0:00 is 12:00 **am**. How does this fit your “easy” greater than 12 subtract 12 rule? (Hint: there is no such time as 24:00)

**ultrafilter** : 0:00 in duodecimal notation is still 0:00, yet it is **AM**. How does this apply your rule of removing the 1 and writing PM for it? **Correct question is how do you get the 12 with your rule?**

Sorry for the inconveniance.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [February 28, 2005, 2:37am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/16 "2005-02-28T02:37:53Z")

</div>

> [@eagle](#):
>
> Sorry, it is late night here in Germany (3:44 AM), so I made errors:
> 
> **Robby** : 12:00 is 12:00 pm, but 0:00 is 12:00 **am**. How does this fit your “easy” greater than 12 subtract 12 rule? (Hint: there is no such time as 24:00)

Not on the standard 24-hour clock, but on mine.

mod operator’s better.

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://boards.straightdope.com/u/eagle)\
**Post date:** [February 28, 2005, 2:40am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/17 "2005-02-28T02:40:42Z")

</div>

Here is an easy to understand conversion “algorithm”: [Converting Between AM/PM and 24 Hour Clock](http://www.nwhiker.com/timeconversion.html#clock)

HTH

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://boards.straightdope.com/u/eagle)\
**Post date:** [February 28, 2005, 2:56am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/18 "2005-02-28T02:56:43Z")

</div>

> [@ultrafilter](#):
>
> Not on the standard 24-hour clock, but on mine.
> 
> mod operator’s better.

Fancy clock you have, but as you say, it is not a standard clock. All my clocks show “0:00” at midnight.

“mod n” in the mathematical sense does not result in a single value but in a set of values that are equal on the modulo of the group. However the computer implementation will return a value in the range of -(n-1) to (n-1) (though newer implementations will usually result in a range of 0 to (n-1)). Yes, you can write Hour12 = 1+((Hour24+11) mod 12) but where do you get the AM/PM from if not from an IF clause? (especially if you allow 24:00 as a valid time?) (I know you can write ampm = ((Hour24 div 12) mod 2) with 0 for am and 1 for pm, but is this really easier to compute for a human brain?)

cu

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [February 28, 2005, 4:36am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/19 "2005-02-28T04:36:26Z")

</div>

> [@eagle](#):
>
> “mod n” in the mathematical sense does not result in a single value but in a set of values that are equal on the modulo of the group.

Not that I’ve ever seen. There’s a modulus operator–which is what you’re referring to as the computer implementation\*–and a modulus relation, which is what you might be thinking of.

\*All the languages I’ve run into implement a remainder operator rather than a modulus operator. The two agree when both arguments are positive.

---

<div class="post-metadata">

**Author:** ![Shalmanese](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Shalmanese](https://boards.straightdope.com/u/Shalmanese)\
**Post date:** [February 28, 2005, 5:22am UTC](https://boards.straightdope.com/t/24-hour-time-conversion/292059/20 "2005-02-28T05:22:10Z")

</div>

what about:

Hour12 = Hour24 % 12;  
if ((Hour24 / 12) % 2)  
AmORPm = “PM”;  
else  
AmORPm = “AM”;  
day = Hour24 / 24;

[Next page](https://boards.straightdope.com/t/24-hour-time-conversion/292059.md?page=2)
