PHP Intl中的Hijri日期不正确

时间:2017-06-22 08:19:54

标签: php date intl hijri

今天在亚洲/德黑兰 27 Ramadan 1438 。但PHP Intl今天说的是 28 Ramadan 1438 。 有谁知道问题是什么?

$DateTime = new DateTime();
$IntlDateFormatter = new IntlDateFormatter(
                    'en_US@calendar=islamic',
                    IntlDateFormatter::FULL,
                    IntlDateFormatter::FULL,
                    'Asia/Tehran',
                    IntlDateFormatter::TRADITIONAL);

echo $IntlDateFormatter->format($DateTime);

2 个答案:

答案 0 :(得分:1)

试试这个:(将日历从伊斯兰改为伊斯兰民用)

$DateTime = new DateTime();
$IntlDateFormatter = new IntlDateFormatter(
                    'en_US@calendar=islamic-civil',
                    IntlDateFormatter::FULL,
                    IntlDateFormatter::FULL,
                    'Asia/Tehran',
                    IntlDateFormatter::TRADITIONAL);

echo $IntlDateFormatter->format($DateTime);

答案 1 :(得分:1)

使用islamic-civil代替islamic