How would I convert this user input:
01/22/2013 2:33 pm
into the normal SQL timestamp format using PHP?
2013-01-22 14:33:00
How would I convert this user input:
01/22/2013 2:33 pm
into the normal SQL timestamp format using PHP?
2013-01-22 14:33:00
Use DateTime
's createFromFormat
$datetime = DateTime::createFromFormat('m/d/Y g:i a', '01/22/2013 2:33 pm');
echo $datetime->format('Y-m-d H:i:s');