所以,如果我使用:
<?php echo date_format($date, "j M Y") ?>
Run Code Online (Sandbox Code Playgroud)
我得到以下格式的日期:1950年1月5日.
然而,我想要的是:1950年1月5日
我该如何添加额外的?
dav*_*ave 12
请看http://www.php.net/manual/en/function.date.php中的格式,但是
<?php echo date_format($date, "jS M Y") ?><br>
Run Code Online (Sandbox Code Playgroud)
对于国际日期,我想你会做类似的事情:
$ordinal = new NumberFormatter($locale, NumberFormatter::ORDINAL);
$ordinal = $ordinal->format(date_format($date, "j"));
$pattern = "d'{$ordinal}' MMM yyyy";
$dateFormatter = new IntlDateFormatter($locale, IntlDateFormatter::FULL, IntlDateFormatter::FULL, $timezone, IntlDateFormatter::GREGORIAN);
$dateFormatter->setPattern($pattern);
$dateFormatter->format($date->getTimestamp());
Run Code Online (Sandbox Code Playgroud)
以上是未经测试但看起来它会起作用.