I have a strange problem . I am trying to insert some values to database with respective date . In HTML form, the date format is mm/dd/yyyy format. I converted this format to mysql yyyy-mm-dd format using the following PHP (from stackoverflow answer):
echo $date1 = str_replace("/","-",$_POST['date']);
echo $date = date('Y-m-d', strtotime($date1));
But the above echo , when I run the code it shows like this:
07-30-2012 1970-01-01
I think this code should work fine, but of course you must do all necessary checks before insert it into database.