Someone once told me there was a trick to converting from 24 hour time to 12 hour time. Does anyone know this trick?
If the time is greater than 1200, subtract 12 from the hour.
No real trick–were you thinking of something else?
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?
Exactly what “shortcut” could there be to subtracting 12 from something?
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.
Yes! Subtract 14 and then add 2.
Hey, it was a good running joke on my old girlfriend for about six months.
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.
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…”
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…
Have our arithmetic skills really gotten so bad that we can’t subtract 12 anymore?
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.
Mod?
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
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.
Not on the standard 24-hour clock, but on mine.
mod operator’s better.
Here is an easy to understand conversion “algorithm”: Converting Between AM/PM and 24 Hour Clock
HTH
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
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.
what about:
Hour12 = Hour24 % 12;
if ((Hour24 / 12) % 2)
AmORPm = “PM”;
else
AmORPm = “AM”;
day = Hour24 / 24;