apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Date_TimeZone

Source Location: /Date-1.4.6/Date/TimeZone.php

Class Overview


TimeZone representation class, along with time zone information data


Author(s):

Version:

  • Release: 1.4.6

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
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:

  • global $_DATE_TIMEZONE_DEFAULT
  • system environment variable PHP_TZ
  • system environment variable TZ
  • 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.



[ Top ]


Class Variables

$default =

[line 99]

System Default Time Zone

Type:   object Date_TimeZone


[ Top ]

$dstlongname =

[line 83]

DST Long Name of this time zone

Type:   string


[ Top ]

$dstshortname =

[line 88]

DST Short Name of this timezone

Type:   string


[ Top ]

$hasdst =

[line 78]

true if this time zone observes daylight savings time

Type:   boolean


[ Top ]

$id =

[line 63]

Time Zone ID of this time zone

Type:   string


[ Top ]

$longname =

[line 68]

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

Type:   string


[ Top ]

$offset =

[line 93]

offset, in milliseconds, of this timezone

Type:   int


[ Top ]

$shortname =

[line 73]

Short Name of this time zone (ie CST)

Type:   string


[ Top ]



Method Detail

Date_TimeZone (Constructor)   [line 113]

object Date_TimeZone Date_TimeZone( string $id)

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

Parameters:

string   $id   —  the time zone id

[ Top ]

getAvailableIDs   [line 320]

mixed getAvailableIDs( )

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

[ Top ]

getDefault   [line 148]

object Date_TimeZone getDefault( )

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

[ Top ]

getDSTLongName   [line 374]

string getDSTLongName( )

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

[ Top ]

getDSTSavings   [line 282]

int getDSTSavings( )

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

[ Top ]

getDSTShortName   [line 387]

string getDSTShortName( )

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

[ Top ]

getID   [line 334]

string getID( )

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

[ Top ]

getLongName   [line 348]

string getLongName( )

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

[ Top ]

getOffset   [line 303]

int getOffset( object Date $date)

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

Parameters:

object Date   $date   —  the Date to test

[ Top ]

getRawOffset   [line 400]

int getRawOffset( )

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

[ Top ]

getShortName   [line 361]

string getShortName( )

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

[ Top ]

hasDaylightTime   [line 240]

boolean hasDaylightTime( )

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

[ Top ]

inDaylightTime   [line 260]

boolean inDaylightTime( object Date $date)

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

Parameters:

object Date   $date   —  the date/time to test

[ Top ]

isEqual   [line 199]

boolean isEqual( object Date_TimeZone $tz)

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

Parameters:

object Date_TimeZone   $tz   —  the timezone to test

[ Top ]

isEquivalent   [line 223]

boolean isEquivalent( object Date_TimeZone $tz)

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

Parameters:

object Date_TimeZone   $tz   —  the timezone object to test

[ Top ]

isValidID   [line 179]

boolean isValidID( string $id)

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

Parameters:

string   $id   —  the id to test

[ Top ]

setDefault   [line 162]

void setDefault( string $id)

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

Parameters:

string   $id   —  the time zone id to use

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:05:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.