I am using the following code to convert user input into a mysql timestamp.
$datetime = DateTime::createFromFormat('m/d/Y g:i a', "{$exp}");
$timestamp = $datetime->format('Y-m-d H:i:s');
where $exp
would equal something like: 06/12/2013 6:41 pm
This works fine on my local server which is running PHP 5.4.3, but when I upload the same script onto my hosting server, It does not want to run this part probably because of the difference in PHP versions.
How would I go about fixing this or an alternative to it? Thanks!