IntlCalendar::getTimeZone

オブジェクトのタイムゾーンを取得する

説明

オブジェクト指向型

public IntlTimeZonefalse IntlCalendar::getTimeZone()

手続き型

IntlTimeZonefalse intlcal_get_time_zone(IntlCalendar $calendar)

このカレンダーに関連付けられた、 IntlTimeZone オブジェクトを返します。

パラメータ

calendar

IntlCalendar クラスのインスタンス。

戻り値

このオブジェクトで内部的に使われている、 関連した IntlTimeZone を返します。 失敗時に false を返します。

例1 IntlCalendar::getTimeZone

<?php
ini_set
('date.timezone''Europe/Lisbon');
ini_set('intl.default_locale''en_US');

$cal IntlCalendar::createInstance();
print_r($cal->getTimeZone());

$cal->setTimeZone('UTC');
print_r($cal->getTimeZone());

$cal IntlCalendar::fromDateTime('2012-01-01 00:00:00 GMT+03:33');
print_r($cal->getTimeZone());

上の例の出力は以下となります。

IntlTimeZone Object
(
    [valid] => 1
    [id] => Europe/Lisbon
    [rawOffset] => 0
    [currentOffset] => 3600000
)
IntlTimeZone Object
(
    [valid] => 1
    [id] => UTC
    [rawOffset] => 0
    [currentOffset] => 0
)
IntlTimeZone Object
(
    [valid] => 1
    [id] => GMT+03:33
    [rawOffset] => 12780000
    [currentOffset] => 12780000
)

参考

  • IntlCalendar::setTimeZone
  • IntlCalendar::createInstance
  • IntlGregorianCalendar::__construct