2017-06-22 9 views
0

今日は27アジア/テヘランにあるRamadan 1438です。しかしPHP Intl今日は28ラマダン1438と言います。 問題は何ですか?PHP Intlで無効なHijri日付

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

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

islamicの(イスラム市民にイスラムから変更カレンダー)を、訪問することができます:[このリンクを](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代わり