Forum Moderators: coopster
Given that the user would be inputting field values as follows:
$month
$day
$year
$hour(24)
$minutes
how do I best construct that into a valid DATETIME value that will go into my INSERT statement?
$datetime = date("r", strtotime("$year-$month-$day $hour:$minutes:00")); ;)
$time = $year . "-" . $month . "-" . $day . " " . $hour . ":" . $minutes . ":00";
Works like a charm, I don't even have to have the leading zeros. I also added a radio button to my form so the user can select AM or PM. I then added this line before the above:
if ($ampm == "pm") { $hour = $hour + 12; }