Hi all, I am using dreamweaver to create a simple dynamic page. I am using php with phpmyadmin. on phpmyadmin the date datatype is default to YYYY-mm-dd I createa a site backend where the admin can insert a record to the databse. On of the fields is date of birth. I have a textfield on the form where the user will enter the date. the current format is the defaut of phpmyadmin (YYYY-mm-dd). I want the user to be able to enter dd/mm/yyyy. with 3 textfields (dd) / (mm) / (yyyy) can some1 help me on this, pls. thanks in advance
$date = explode('/', $_POST['date']); if (count$date) == 3) { $mysql_date = $date[2] . '-' . $date[1] . '-' . $date[0]; } else { //incorrect input } PHP:
i recommend using time stamps... better for storing and easier to change format when you get the input you'll do something such as $date_of_birth = mktime(0,0,0,$month, $day, $year); store it and then you can output as echo date('Y-m-d', $date_of_birth);