Page 1 of 1

24 hour date/time conversion issue

Posted: Tue Oct 31, 2006 12:45 pm
by kendall
i'm trying to do a 24hr date conversion here using PHP and something just struck me....

is 12 midnight 12 am or is 12 noon 12 pm?

I'm trying to work out a code where i have a drop down lis of the hours 1- 12 and minutes 0 - 59

and i have php snippet where

Code: Select all

if($t == 'pm'){
$hour = 12+$hour;
}
now this is to be entered into a date time mysql datatype column that has 0-23

a 24hr time would give me 00:00:00 in my database entry.

so my question is...what is the correct calculations to use?

Kendall

Posted: Tue Oct 31, 2006 5:48 pm
by feyd
noon is 12 pm, midnight is 12 am.