2017-06-22 49 views
0

今天是27斋月1438在亚洲/德黑兰。但PHP Intl今天说是28斋月1438。 任何人都知道问题是什么?PHP国际中不正确的Hijri日期

$DateTime = new DateTime(); 
$IntlDateFormatter = new IntlDateFormatter(
        '[email protected]=islamic', 
        IntlDateFormatter::FULL, 
        IntlDateFormatter::FULL, 
        'Asia/Tehran', 
        IntlDateFormatter::TRADITIONAL); 

echo $IntlDateFormatter->format($DateTime); 
+0

我写此功能的helper方法,可以访问:此链接](https://stackoverflow.com/questions/43332341/php-intl-can-convert-a-gregorian-date-to-other-calendar-type/46275845#46275845)你可以传递日历类型给他们 – honarkhah

回答

1

试试这个:(改变压延伊斯兰伊斯兰公务员)

$DateTime = new DateTime(); 
$IntlDateFormatter = new IntlDateFormatter(
        '[email protected]=islamic-civil', 
        IntlDateFormatter::FULL, 
        IntlDateFormatter::FULL, 
        'Asia/Tehran', 
        IntlDateFormatter::TRADITIONAL); 

echo $IntlDateFormatter->format($DateTime); 
1

使用islamic-civil代替islamic