timezone_transitions_get()函数返回时区的所有转换。
timezone_transitions_get(obj)
obj -DateTimeZone对象
timezone_transitions_get()函数返回包含关联数组的数字索引数组,该数组在成功时会发生所有转换,而在失败时会发生FALSE。
以下是一个例子-
<?php $tz = timezone_open('Asia/Colombo'); $res= timezone_transitions_get( $tz ); print_r(array_slice($res, 0, 2)); ?>
输出结果
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 ) )
让我们看另一个例子-
<?php $tz = timezone_open('Europe/Paris'); $res = timezone_transitions_get( $tz ); print_r(array_slice($res, 0, 2)); ?>
输出结果
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 )