English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Date & Time Function Manual
The timezone_transitions_get() function returns all transitions of the timezone.
timezone_transitions_get()function isDateTimeZone ::getTransitions() alias. It accepts a DateTimeZone object as a parameter and returns the transitions of the given timezone.
timezone_transitions_get($object, $timestamp_start, $timestamp_end)
Number | Parameters and descriptions |
---|---|
1 | object (required) This is a DateTimeZone object. |
2 | timestamp_start (optional) represents the integer value of the timestamp of the start time. |
3 | timestamp_end (optional) represents the integer value of the timestamp of the end time. |
The PHP timezone_transitions_get() function returns all transitions in array form. If it fails, this function returns a boolean valuefalse.
This function was originally introduced in PHP version5.2introduced in PHP version 5.2.0 and is available in all higher versions.
The following example demonstratesdate_default_timezone_getUsage of the function-
<?php $tz = new DateTimeZone("Indian/Mahe"); $list = timezone_transitions_get($tz); print_r($list); ?>Test and see‹/›
Output result
Array ( [0] => Array ( [ts] => -9223372036854775808 [time] => -292277022657-01-27T08:29:52+0000 [offset] => 13308 [isdst] => [abbr] => LMT ) [1] => Array ( [ts] => -2006653308 [time] => 1906-05-31T20:18:12+0000 [offset] => 14400 [isdst] => [abbr] => +04 ) [2] => Array ( [ts] => 2147483647 [time] => 2038-01-19T03:14:07+0000 [offset] => 14400 [isdst] => [abbr] => +04 ) )
Returns all transitions of the timezone
<?php $timezone = new DateTimeZone("CET"); print_r(reset($timezone->getTransitions())); echo"------------------------------------------------\n"; print_r(reset(timezone_transitions_get($timezone))); ?>Test and see‹/›
Output 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 )