Php-function-timezone-abbreviations-list

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

PHP-関数timezone_abbreviations_list()

構文

array timezone_abbreviations_list ( void );

array DateTimeZone::listAbbreviations ( void );

定義と使い方

これらの関数は、dst、オフセット、タイムゾーン名を含む連想配列を返します。

上記の2つの関数は同等であり、以下の例に示すように、任意の関数を使用できます。

パラメーター

Sr.No Parameter & Description
1

void

NA

戻り値

成功すると配列を返し、失敗するとFALSEを返します。

以下は、この機能の使用法です-

<?php
   $timezone_abbreviations = timezone_abbreviations_list ();
   print_r($timezone_abbreviations["acst"]);
   echo "----------------------------------------------\n";

   # Using second function.
   $timezone_abbreviations = DateTimeZone::listAbbreviations();

   print_r($timezone_abbreviations["acst"]);
?>

これは、次の結果を生成します-

Array (
   [0] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Porto_Acre
   )
   [1] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Eirunepe
   )
   [2] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Rio_Branco
   )
   [3] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => Brazil/Acre
   )
)
------------------------------------------------------
Array (
   [0] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Porto_Acre
   )
   [1] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Eirunepe
   )
   [2] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => America/Rio_Branco
   )
   [3] => Array (
      [dst] => 1
      [offset] => -14400
      [timezone_id] => Brazil/Acre
   )
)