php - 转换2012-06-25 19:00:00到另一种格式[重复]

This question already has an answer here:

via xml, I am getting variables that give time in this format: 2012-06-25 19:00:00

I'd like it to be converted in this format: June 25 - 7:00PM

I have looked at mktime and strtotime, but im not sure how to handle a format that comes as a date AND time.

</div>

As you said, you can use strtotime:

echo date('F-m - h:iA', strtotime($old_format));
<?php

$input = "2012-06-25 19:00:00";

$dateTimeObject = new DateTime($input);
echo "First way: " . $dateTimeObject->format("F d - g:iA") . "<br>
";

$date = date("F d - g:iA", strtotime($input));
echo "Second way: " . $date;