I have a datetime variable which is being passed in the following format.
I need to convert to mysql for inclusion in db, but in my script it keeps changing to:
I have tried the following code but no joy:
$intakedate = $_POST['brdatetimepicker']; $intakedate = str_replace(' ', '', $intakedate); $intakedate = DateTime::createFromFormat('d/m/Y H:i:s', $intakedate)->format('Y-m-d H:i:s');
I would be grateful if someone could help with this. Many thanks.