예제 #1
0
 /**
  * Constructor
  *
  * Creates a new Date::TimeZone object, representing the time zone
  * specified in $id.  If the supplied ID is invalid, the created
  * time zone is UTC.
  *
  * @access public
  * @param string $id the time zone id
  * @return object Date_TimeZone the new Date_TimeZone object
  */
 function Date_TimeZone($id)
 {
     $_DATE_TIMEZONE_DATA = $GLOBALS['_DATE_TIMEZONE_DATA'];
     if (Date_TimeZone::isValidID($id)) {
         self::$id = $id;
         self::$longname = $_DATE_TIMEZONE_DATA[$id]['longname'];
         self::$shortname = $_DATE_TIMEZONE_DATA[$id]['shortname'];
         self::$offset = $_DATE_TIMEZONE_DATA[$id]['offset'];
         if ($_DATE_TIMEZONE_DATA[$id]['hasdst']) {
             self::$hasdst = true;
             self::$dstlongname = $_DATE_TIMEZONE_DATA[$id]['dstlongname'];
             self::$dstshortname = $_DATE_TIMEZONE_DATA[$id]['dstshortname'];
         } else {
             self::$hasdst = false;
             self::$dstlongname = self::$longname;
             self::$dstshortname = self::$shortname;
         }
     } else {
         self::$id = 'UTC';
         self::$longname = $_DATE_TIMEZONE_DATA[self::$id]['longname'];
         self::$shortname = $_DATE_TIMEZONE_DATA[self::$id]['shortname'];
         self::$hasdst = $_DATE_TIMEZONE_DATA[self::$id]['hasdst'];
         self::$offset = $_DATE_TIMEZONE_DATA[self::$id]['offset'];
     }
 }