\Horde_Timezone

Base class for loading, parsing, and working with timezones.

This class is the central point to fetch timezone information from the timezone (Olson) database, parse it, cache it, and generate VTIMEZONE objects.

Usage: $tz = new Horde_Timezone(); $tz->getZone('America/New_York')->toVtimezone()->exportVcalendar();

Documentation on the database file formats can be found at ftp://ftp.iana.org/tz/tz-how-to.html

Summary

Methods
Properties
Constants
__construct()
getMonth()
getZone()
getRule()
No public properties found
No constants found
_download()
_extractAndParse()
_parse()
$_params
$_tmpfile
$_zones
$_rules
$_links
$_months
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Any configuration parameters for this class.

Type

array

$_tmpfile

$_tmpfile : string

File location of the downloaded timezone database.

Type

string

$_zones

$_zones : array

List of all Zone entries parsed into Horde_Timezone_Zone objects.

Type

array

$_rules

$_rules : array

List of all Rule entries parsed into Horde_Timezone_Rule objects.

Type

array

$_links

$_links : array

Alias map of all Link entries.

Type

array

$_months

$_months : array

List to map month descriptions used in the timezone database.

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

List of optional class parameters. Possible options:

  • location: (string) Location of the timezone database, defaults to ftp.iana.org/tz/tzdata-latest.tar.gz.
  • client: (Horde_Http_Client) A preconfigured HTTP client for downloading via HTTP.
  • temp: (string) Temporary directory.
  • cache: (Horde_Cache) A cache object.
  • cachettl: (integer) Cache lifetime in seconds, defaults to 7 days.

getMonth()

getMonth(string  $month) : integer

Returns the month number of a month name.

Parameters

string $month

A month name.

Returns

integer —

The month's number.

getZone()

getZone(string  $zone) : \Horde_Timezone_Zone

Returns an object representing an invidual timezone.

Maps to a "Zone" entry in the timezone database. Works with zone aliases and other common timezone names too.

Parameters

string $zone

A timezone name.

Returns

\Horde_Timezone_Zone

A timezone object.

getRule()

getRule(string  $rule) : \Horde_Timezone_Rule

Returns an object representing a set of named transition rules.

Maps to a list Rule entries of the same name in the timezone database.

Parameters

string $rule

A rule name.

Returns

\Horde_Timezone_Rule

A rule object.

_download()

_download() 

Downloads a timezone database.

Throws

\Horde_Timezone_Exception

if downloading fails.

_extractAndParse()

_extractAndParse() 

Unpacks the downloaded timezone database and parses all files.

_parse()

_parse(string  $file) 

Parses a file from the timezone database.

Parameters

string $file

A file location.