Php/docs/intldateformatter.gettimezoneid

提供:Dev Guides
< Php
移動先:案内検索

IntlDateFormatter::getTimeZoneId

datefmt_get_timezone_id

(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)

IntlDateFormatter::getTimeZoneId -- datefmt_get_timezone_idIntlDateFormatter が使用するタイムゾーン ID を取得する


説明

オブジェクト指向型

public IntlDateFormatter::getTimeZoneId ( ) : string

手続き型

datefmt_get_timezone_id ( IntlDateFormatter $fmt ) : string

IntlDateFormatter が使用するタイムゾーン ID を取得します。


パラメータ

fmt
Formatter リソース。


返り値

この Formatter が使用するタイムゾーンの ID 文字列を返します。


例1 datefmt_get_timezone_id() の例

<?php$fmt = datefmt_create(    'en_US',    IntlDateFormatter::FULL,    IntlDateFormatter::FULL,    'America/Los_Angeles',    IntlDateFormatter::GREGORIAN);echo 'timezone_id of the formatter is : ' . datefmt_get_timezone_id($fmt);datefmt_set_timezone_id($fmt, 'CN');echo 'Now timezone_id of the formatter is : ' . datefmt_get_timezone_id($fmt);?>

例2 オブジェクト指向の例

<?php$fmt = new IntlDateFormatter(    'en_US',    IntlDateFormatter::FULL,    IntlDateFormatter::FULL,    'America/Los_Angeles',    IntlDateFormatter::GREGORIAN);echo 'timezone_id of the formatter is : ' . $fmt->getTimezoneId();$fmt->setTimezoneId('CN');echo 'Now timezone_id of the formatter is : ' . $fmt->getTimezoneId();?>

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

timezone_id of the formatter is : America/Los_Angeles
Now timezone_id of the formatter is : CN

参考