我一直在拿号码而不是月份名字.我需要得到像七月这样的月份名称.
$formatter = new \IntlDateFormatter(
"fa_IR@calendar=persian",
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'Asia/Tehran',
\IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy mm dd');
$formatter->format($time)
Run Code Online (Sandbox Code Playgroud)
你可以使用MMMM.
所有可用的模式都在此链接上
$formatter = new \IntlDateFormatter(
"fa_IR@calendar=persian",
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'Asia/Tehran',
\IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy MMMM dd');
$formatter->format($time)
Run Code Online (Sandbox Code Playgroud)
这个问题与此相同
| 归档时间: |
|
| 查看次数: |
482 次 |
| 最近记录: |