Entry
How do I convert form values into MySQL datetime format using php?
Aug 6th, 2003 19:48
Justin Dalrymple, Joe Calino,
You'll want to string your variables together into the proper format.
PHP does this by putting a "." between fields that need to be concatenated.
Example:
<?php
// You'll want to remove these since you are using data from your form
$year = "2003";
$month = "08";
$day = "06";
$hours = "22";
$minutes = "01";
$seconds = "35";
$date = $year . "-" . $month . "-" . $day;
$time = $hours . ":" . $minutes . ":" . $seconds;
$datetime = $date . " " . $time;
// Print it out
echo ($datetime);
?>