Documentation

Horde_Timezone
in package

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

Tags
author

Jan Schneider jan@horde.org

Table of Contents

$_links  : array<string|int, mixed>
Alias map of all Link entries.
$_months  : array<string|int, mixed>
List to map month descriptions used in the timezone database.
$_params  : array<string|int, mixed>
Any configuration parameters for this class.
$_rules  : array<string|int, mixed>
List of all Rule entries parsed into Horde_Timezone_Rule objects.
$_tmpfile  : string
File location of the downloaded timezone database.
$_zones  : array<string|int, mixed>
List of all Zone entries parsed into Horde_Timezone_Zone objects.
__construct()  : mixed
Constructor.
getMonth()  : int
Returns the month number of a month name.
getRule()  : Horde_Timezone_Rule
Returns an object representing a set of named transition rules.
getZone()  : Horde_Timezone_Zone
Returns an object representing an invidual timezone.
_download()  : mixed
Downloads a timezone database.
_extractAndParse()  : mixed
Unpacks the downloaded timezone database and parses all files.
_parse()  : mixed
Parses a file from the timezone database.

Properties

Alias map of all Link entries.

protected array<string|int, mixed> $_links = array()

$_months

List to map month descriptions used in the timezone database.

protected static array<string|int, mixed> $_months = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3, 'Apr' => 4, 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec' => 12)

$_params

Any configuration parameters for this class.

protected array<string|int, mixed> $_params

$_rules

List of all Rule entries parsed into Horde_Timezone_Rule objects.

protected array<string|int, mixed> $_rules = array()

$_tmpfile

File location of the downloaded timezone database.

protected string $_tmpfile

$_zones

List of all Zone entries parsed into Horde_Timezone_Zone objects.

protected array<string|int, mixed> $_zones = array()

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

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.
Return values
mixed

getMonth()

Returns the month number of a month name.

public static getMonth(string $month) : int
Parameters
$month : string

A month name.

Return values
int

The month's number.

getRule()

Returns an object representing a set of named transition rules.

public getRule(string $rule) : Horde_Timezone_Rule

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

Parameters
$rule : string

A rule name.

Return values
Horde_Timezone_Rule

A rule object.

getZone()

Returns an object representing an invidual timezone.

public getZone(string $zone) : Horde_Timezone_Zone

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

Parameters
$zone : string

A timezone name.

Return values
Horde_Timezone_Zone

A timezone object.

_extractAndParse()

Unpacks the downloaded timezone database and parses all files.

protected _extractAndParse() : mixed
Return values
mixed

_parse()

Parses a file from the timezone database.

protected _parse(string $file) : mixed
Parameters
$file : string

A file location.

Return values
mixed

Search results