Class Date_TimeZone

Description

TimeZone representation class, along with time zone information data.

TimeZone representation class, along with time zone information data. The default timezone is set from the first valid timezone id found in one of the following places, in this order:
1) global $_DATE_TIMEZONE_DEFAULT
2) system environment variable PHP_TZ
3) system environment variable TZ
4) the result of date('T')
If no valid timezone id is found, the default timezone is set to 'UTC'. You may also manually set the default timezone by passing a valid id to Date_TimeZone::setDefault().

This class includes time zone data (from zoneinfo) in the form of a global array, $_DATE_TIMEZONE_DATA.

Located in /maintenance/libraries/pear/Date/TimeZone.php (line 48)


	
			
Variable Summary
Method Summary
 mixed getAvailableIDs ()
 string getDSTLongName ()
 int getDSTSavings ()
 string getDSTShortName ()
 string getID ()
 string getLongName ()
 int getOffset (object Date $date)
 int getRawOffset ()
 string getShortName ()
 boolean hasDaylightTime ()
 boolean inDaylightTime (object Date $date)
 boolean isEqual (object Date_TimeZone $tz)
 boolean isValidID (string $id)
 void setDefault (string $id)
Variables
object Date_TimeZone $default (line 90)

System Default Time Zone

string $dstlongname (line 74)

DST Long Name of this time zone

string $dstshortname (line 79)

DST Short Name of this timezone

boolean $hasdst (line 69)

true if this time zone observes daylight savings time

string $id (line 54)

Time Zone ID of this time zone

string $longname (line 59)

Long Name of this time zone (ie Central Standard Time)

int $offset (line 84)

offset, in milliseconds, of this timezone

string $shortname (line 64)

Short Name of this time zone (ie CST)

Methods
Constructor Date_TimeZone (line 104)

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.

  • return: the new Date_TimeZone object
  • access: public
object Date_TimeZone Date_TimeZone (string $id)
  • string $id: the time zone id
getAvailableIDs (line 311)

Returns the list of valid time zone id strings

Returns the list of valid time zone id strings

  • return: an array of strings with the valid time zone IDs
  • access: public
mixed getAvailableIDs ()
getDefault (line 139)

Return a TimeZone object representing the system default time zone

Return a TimeZone object representing the system default time zone, which is initialized during the loading of TimeZone.php.

  • return: the default time zone
  • access: public
object Date_TimeZone getDefault ()
getDSTLongName (line 365)

Returns the DST long name for this time zone

Returns the DST long name for this time zone, i.e. "Central Daylight Time"

  • return: the daylight savings time long name
  • access: public
string getDSTLongName ()
getDSTSavings (line 273)

Get the DST offset for this time zone

Returns the DST offset of this time zone, in milliseconds, if the zone observes DST, zero otherwise. Currently the DST offset is hard-coded to one hour.

  • return: the DST offset, in milliseconds or zero if the zone does not observe DST
  • access: public
int getDSTSavings ()
getDSTShortName (line 378)

Returns the DST short name for this time zone

Returns the DST short name for this time zone, i.e. "CDT"

  • return: the daylight savings time short name
  • access: public
string getDSTShortName ()
getID (line 325)

Returns the id for this time zone

Returns the time zone id for this time zone, i.e. "America/Chicago"

  • return: the id
  • access: public
string getID ()
getLongName (line 339)

Returns the long name for this time zone

Returns the long name for this time zone, i.e. "Central Standard Time"

  • return: the long name
  • access: public
string getLongName ()
getOffset (line 294)

Get the DST-corrected offset to UTC for the given date

Attempts to get the offset to UTC for a given date/time, taking into account daylight savings time, if the time zone observes it and if it is in effect. Please see the WARNINGS on Date::TimeZone::inDaylightTime().

  • return: the corrected offset to UTC in milliseconds
  • access: public
int getOffset (object Date $date)
getRawOffset (line 391)

Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone

Returns the raw (non-DST-corrected) offset from UTC/GMT for this time zone

  • return: the offset, in milliseconds
  • access: public
int getRawOffset ()
getShortName (line 352)

Returns the short name for this time zone

Returns the short name for this time zone, i.e. "CST"

  • return: the short name
  • access: public
string getShortName ()
hasDaylightTime (line 231)

Returns true if this zone observes daylight savings time

Returns true if this zone observes daylight savings time

  • return: true if this time zone has DST
  • access: public
boolean hasDaylightTime ()
inDaylightTime (line 251)

Is the given date/time in DST for this time zone

Attempts to determine if a given Date object represents a date/time that is in DST for this time zone. WARNINGS: this basically attempts to "trick" the system into telling us if we're in DST for a given time zone. This uses putenv() which may not work in safe mode, and relies on unix time which is only valid for dates from 1970 to ~2038. This relies on the underlying OS calls, so it may not work on Windows or on a system where zoneinfo is not installed or configured properly.

  • return: true if this date is in DST for this time zone
  • access: public
boolean inDaylightTime (object Date $date)
isEqual (line 190)

Is this time zone equal to another

Tests to see if this time zone is equal (ids match) to a given Date_TimeZone object.

  • return: true if this time zone is equal to the supplied time zone
  • access: public
boolean isEqual (object Date_TimeZone $tz)
isEquivalent (line 214)

Is this time zone equivalent to another

Tests to see if this time zone is equivalent to a given time zone object. Equivalence in this context is defined by the two time zones having an equal raw offset and an equal setting of "hasdst". This is not true equivalence, as the two time zones may have different rules for the observance of DST, but this implementation does not know DST rules.

  • return: true if this time zone is equivalent to the supplied time zone
  • access: public
boolean isEquivalent (object Date_TimeZone $tz)
isValidID (line 170)

Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data

Tests if given id is represented in the $_DATE_TIMEZONE_DATA time zone data

  • return: true if the supplied ID is valid
  • access: public
boolean isValidID (string $id)
  • string $id: the id to test
setDefault (line 153)

Sets the system default time zone to the time zone in $id

Sets the system default time zone to the time zone in $id

  • access: public
void setDefault (string $id)
  • string $id: the time zone id to use

Documentation generated on Fri, 3 Dec 2004 12:27:58 +0000 by phpDocumentor 1.3.0RC3