PHP timezone_open()関数
例
新しいDateTimeZoneオブジェクトを作成し、タイムゾーンの名前を返します。
<?php
$tz=timezone_open("Europe/Paris");
echo timezone_name_get($tz);
?>
定義と使用法
timezone_open()は、新しいDateTimeZoneオブジェクトを作成します。
構文
以下の2つの関数は同等であり、上記の例に示すように、どの関数も使用できます。
手続き型:
timezone_open(timezone)
オブジェクト指向スタイル:
DateTimeZone::__construct(timezone)
パラメータ値
Parameter | Description |
---|---|
timezone | Required. Specifies a timezone Tip: Look at a list of all supported timezones in PHP |
技術的な詳細
戻り値: | 成功するとDateTimeZoneオブジェクトを返します。失敗するとFALSE |
---|---|
PHPバージョン: | 5.2+ |
PHP変更ログ: | PHP 5.5.1:タイムゾーンパラメータはオフセット値を受け入れます |
❮PHPの日付/時刻リファレンス