Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个像“2013-05-07”这样的字符串,我想通过任何功能方式(如果可用)或尽可能简短的方法将其转换为“2013 年 5 月 7 日”
$dt = new DateTime('2013-05-07'); echo $dt->format('j F Y');
自 PHP 5.4 起
echo (new DateTime('2013-05-07'))->format('j F Y');
PHP 日期格式
echo date('j F Y', strtotime("2013-05-07"));