Monday, 26 August 2013

PHP Function timezone_transitions_get()

Syntax

array timezone_transitions_get ( DateTimeZone $object )

array DateTimeZone::getTransitions ( void )

Definition and Usage

These functions return all transitions for the timezone.
The above two functions are equivalent and any of the functions can be used as shown below in the example.

Paramters

ParameterDescription
objectDateTimeZone object.

Return Value

Returns numerically indexed array containing associative array with all transitions on success or FALSE on failure.

Example

Following is the usage of this function:
<?php
$timezone = new DateTimeZone("CET");
print_r(reset($timezone->getTransitions()));

echo"------------------------------------------------\n";

print_r( reset( timezone_transitions_get ($timezone) ) );
?>
This will produce following result:
Array
(
    [ts] => -1693706400
    [time] => 1916-04-30T22:00:00+0000
    [offset] => 7200
    [isdst] => 1
    [abbr] => CEST
)
------------------------------------------------
Array
(
    [ts] => -1693706400
    [time] => 1916-04-30T22:00:00+0000
    [offset] => 7200
    [isdst] => 1
    [abbr] => CEST
)

No comments:

Post a Comment