i18n\Formatter $calendar

$calendar public property (available since version 2.0.7)

The calendar to be used for date formatting. The value of this property will be directly passed to the constructor of the IntlDateFormatter class.

Defaults to null, which means the Gregorian calendar will be used. You may also explicitly pass the constant \IntlDateFormatter::GREGORIAN for Gregorian calendar.

To use an alternative calendar like for example the Jalali calendar, set this property to \IntlDateFormatter::TRADITIONAL. The calendar must then be specified in the $locale, for example for the persian calendar the configuration for the formatter would be:

'formatter' => [
    'locale' => 'fa_IR@calendar=persian',
    'calendar' => \IntlDateFormatter::TRADITIONAL,
],

Available calendar names can be found in the ICU manual.

Since PHP 5.5 you may also use an instance of the \IntlCalendar class. Check the PHP manual for more details.

If the PHP intl extension is not available, setting this property will have no effect.

See also:

public \IntlCalendar|integer|null $calendar = null
doc_Yii
2016-10-30 17:05:51
Comments
Leave a Comment

Please login to continue.