Question : Converting Date Format in PHP

I have a database that is working great with the form for a date if the date is entered in as YYYY-MM-DD

The user wants to enter the date as MM-DD-YYYY but if they do that, it doesn't write to the database which is a date field

How do I convert it so the database recognizes it?
1:
2:
3:
Here is the code for the entry of the date
echo "<input type=\"text\" name=\"weddingdate\" value=\"$weddingdate\">\n";
		echo "<A HREF=\"#\" onClick=\"cal.select(document.forms['update_form'].weddingdate, 'anchor1', 'yyyy/MM/dd'); return false;\" NAME=\"anchor1\" ID=\"anchor1\"><img src=\"../images/b_calendar.png\" border=\"0\"  /></A></td>\n";

Answer : Converting Date Format in PHP

or

$weddingdate = date("Y-m-d",strtotime($_POST['weddingdate']);

would be a quick wrapper on your $_POST var
Random Solutions  
 
programming4us programming4us