>
> ... wrote my own routine to convert from 24hr to am/pm. The logic is not only non-trivial, it actually isn't logical ;).>
>It seems pretty trivial to me ... if you first convert the hour portion of a time string to a number. Subtract 12 from anything > 12, then put it back in the time string.
Actually, not quite. Subtract 12 from anything >=13. Up to 12:59 you still don't subtract, but AM is only until 11:59. So you subtract for times on or after 13:00, but it's PM for anything on or after 12:00.
My trouble actually came from what Latin I still remember. I didn't learn the AM/PM stuff at school (we learned 24hr, and the 2x12 was just what we used at home, no hard rules there, and no Latin involved, just rules-of-thumb), so I tried to use logic. "Ante" means "before", "post" means "after". Of course I got the noon wrong, and the time between 12:01 and 12:59 as well (now I can't understand how did I manage to do that wrong, but just goes to show how I get confused when there are more rules than logic :).