IntlDateFormatter::getCalendarObject
datefmt_get_calendar_object
(PHP 5 >= 5.5.0, PHP 7, PECL intl >= 3.0.0)
IntlDateFormatter::getCalendarObject -- datefmt_get_calendar_object — カレンダーオブジェクトのコピーを取得する
説明
オブジェクト指向型
public IntlDateFormatter::getCalendarObject ( ) : IntlCalendar
手続き型
datefmt_get_calendar_object ( ) : IntlCalendar
このフォーマッターが内部的に使うカレンダーオブジェクトのコピーを取得します。 このカレンダーには型 (gregorian、japanese、buddhist、roc、persian、 islamic など) やタイムゾーンが設定されており、フォーマッターが使っている型やタイムゾーンと一致します。 オブジェクトの日付や時刻は指定されていません。
パラメータ
この関数にはパラメータはありません。
返り値
このフォーマッターが内部的に使うカレンダーオブジェクトのコピーを返します。
例
例1 IntlDateFormatter::getCalendarObject() の例
<?php$formatter = IntlDateFormatter::create( "fr_FR@calendar=islamic", NULL, NULL, "GMT-01:00", IntlDateFormatter::TRADITIONAL);$cal = $formatter->getCalendarObject();var_dump( $cal->getType(), $cal->getTimeZone(), $cal->getLocale(Locale::VALID_LOCALE));
上の例の出力は以下となります。
string(7) "islamic" object(IntlTimeZone)#3 (4) { ["valid"]=> bool(true) ["id"]=> string(9) "GMT-01:00" ["rawOffset"]=> int(-3600000) ["currentOffset"]=> int(-3600000) } string(5) "fr_FR"
参考
- IntlDateFormatter::getCalendar() - IntlDateFormatter が使用するカレンダー型を取得する
- IntlDateFormatter::setCalendar() - Formatter が使うカレンダー型を設定する
- IntlCalendar