Computer >> Computer tutorials >  >> Programming >> PHP

timezone_transitions_get() function in PHP


The timezone_transitions_get() function returns all transitions for the timezone.

Syntax

timezone_transitions_get(obj)

Parameters

  • obj  − DateTimeZone object

Return

The timezone_transitions_get() function returns numerically indexed array containing associative array with all transitions on success or FALSE on failure.

Example

The following is an example −

<?php
$tz = timezone_open('Asia/Colombo');
$res= timezone_transitions_get( $tz );
print_r(array_slice($res, 0, 2));
?>

Output

Array (
   [0] => Array (
      [ts] => -9223372036854775808
      [time] => -292277022657-01-27T08:29:52+0000
      [offset] => 19164
      [isdst] =>
      [abbr] => LMT
   )
   [1] => Array (
      [ts] => -2147483648
      [time] => 1901-12-13T20:45:52+0000
      [offset] => 19172
      [isdst] =>
      [abbr] => MMT
   )
)

Let us see another example −

Example

<?php
$tz = timezone_open('Europe/Paris');
$res = timezone_transitions_get( $tz );
print_r(array_slice($res, 0, 2));
?>

Output

Array (
[0] => Array (
   [ts] => -9223372036854775808
   [time] => -292277022657-01-27T08:29:52+0000
   [offset] => 561
   [isdst] =>
   [abbr] => LMT
)
[1] => Array (
   [ts] => -2147483648
   [time] => 1901-12-13T20:45:52+0000
   [offset] => 561
   [isdst] =>
   [abbr] => PMT
)