24 hour date/time conversion issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

24 hour date/time conversion issue

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

noon is 12 pm, midnight is 12 am.
Post Reply