I've searched many questions, but every solution I tried, failed.
Basically, I get a string, for example: "1994-10-29" I have a Date field inside my SQL database. I want to convert this to a Date but when I do, I always get 1970-01-01 which indicates the conversion failed.
My code:
$date = $_GET["age"];
$dob = strtotime($date);
$date_of_birth = date('Y-m-d', $dob);
This is where it goes wrong. I've echo'd the $date and I get the right string from it. The INSERT statement after it also works, since I've tried it with a handpicked date.
I also read a solution where they user str_replace, tried replacing the '-' in my string with '/' but still didn't work.
Hope someone can help me out!