I have been developing on php 5.3.
However our production server is 5.2.6.
I have been using
$schedule = '31/03/2011 01:22 pm'; // example input
if (empty($schedule))
$schedule = date('Y-m-d H:i:s');
else {
$schedule = dateTime::createFromFormat('d/m/Y h:i a', $schedule);
$schedule = $schedule->format('Y-m-d H:i:s');
}
echo $schedule;
However that function is not available in 5.2
What is the easiest way to get around this (no chance of a php upgrade).
See Question&Answers more detail:os