例如2014年2月22日对2014年2月22日或2014年2月22日。
strftime已经需要固定格式,只需更改文本。
是否可以(php 5.3-大型基础设施,尚未更新)使用setlocale并根据本地规范格式化日期?

最佳答案

$dt = new DateTime($datetime);
$formatter = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
return $formatter->format($dt);

在四处挖掘之后,这是我发现的最接近的。

10-04 15:28