I am having trouble inserting datetime $_POST into mysql. I am getting an error of:
Warning : date_format() expects parameter 1 to be DateTime, string given in
I have tried various options but either get error or enters 1970. I would be grateful if someone could point out my error. Here is the value and format that is being passed for conversion:
The PM in that date is weird. It’s either 2:00PM or 14:00, but not 14:00 PM. Can you get rid of the PM in the input?
Anyway, this works:
$intakedate = '06/02/2019 14:45:49 PM';
// remove next line if you can remove "PM" from the input somewhere else
$intakedate = str_replace(' PM', '', $intakedate);
$intakedate = DateTime::createFromFormat('d/m/Y H:i:s', $intakedate)->format('Y-m-d H:i:s');
It has reached its End Of Life so long ago it isn’t even on the chart
EOL means it doesn’t get bug, security or critical security fixes. Nada, zip, zilch
A release that is no longer supported. Users of this release should upgrade as soon as possible, as they may be exposed to unpatched security vulnerabilities.
True, there is nothing saying everyone should be on the absolute latest release version. And I realize setting up a development environment isn’t always an enjoyable experience. IMHO you should take the “as soon as possible” seriously, and make the effort to upgrade to a version that is still supported.
If you are having problems upgrading please start a topic asking for help. There are different ways to set up development environments, and someone else’s preferred way may not be your preferred way, but you really should upgrade as soon as possible.