I am just trying to pass a date into sql as a DATE (XXXX-XX-XX format), but I can't seem to get sprintf to accept my string date-components. I seem to be following the documentation correctly. using php5.5
$year = ($_POST['year']);
$month = ($_POST['month']);
$day = ($_POST['day']);
var_dump shows:
string(4) "1991" string(1) "8" string(1) "5"
however both of these var_dumps are empty:
$dobexpanded =sprintf("%04s-%02s-%02s", $year, $month, $day);
$dateofbirth = (STR_TO_DATE('$dobexpanded', '%Y-%m-%d'));
var_dump($dobexpanded);
var_dump($dateofbirth);