Home >>PHP Date Time Functions >PHP timezone_transitions_get() Function
PHPtimezone_transitions_get() function is used to get all the transitions for the timezone. It accepts three parameters$object, $timestamp_begin, and $timestamp_end. It returns an associative array as output containing all transitions on success and False on failure.
Syntax:
timezone_transitions_get($object,$timestamp_begin, $timestamp_end);
Parameter | Description |
---|---|
object | This is a required parameter for procedural style. This parameterdefines theDateTimeZone object. |
timestamp_start | This is an optional parameter. This parameter definesbegin timestamp. |
timestamp_end | This is an optional parameter. This parameter definesend timestamp. |
Here is an example of timezone_transitions_get() function in PHP:
<html> <body> <pre> <?php $timezone = new DateTimeZone("Asia/Kolkata"); print_r(reset(timezone_transitions_get($timezone))); // Procedural style ?> </pre> </body> </html>
Array ( [ts] => -9223372036854775808 [time] => -292277022657-01-27T08:29:52+0000 [offset] => 21200 [isdst] => [abbr] => HMT )
Example 2:
<html> <body> <pre> <?php $timezone = new DateTimeZone("Asia/Kolkata"); print_r(reset($timezone->getTransitions()));// Object oriented style ?> </pre> </body> </html>
Array ( [ts] => -9223372036854775808 [time] => -292277022657-01-27T08:29:52+0000 [offset] => 21200 [isdst] => [abbr] => HMT )