如何转换此时间格式?

Rya*_*yan 1 php mysql time

2011-07-13 02:38:31
Run Code Online (Sandbox Code Playgroud)

^ MySQL格式.

我想使用PHP将其转换为另一种格式,例如,2011年7月13日凌晨2:38.

She*_*hef 5

<?php
$time_from_db = '2011-07-13 02:38:31';

echo date('F j, Y g:i a', strtotime($time_from_db));
?>
Run Code Online (Sandbox Code Playgroud)