在线文档教程
PHP
日期和时间 | Date and Time

DateTimeZone::getTransitions

DateTimeZone::getTransitions

timezone_transitions_get

(PHP 5 >= 5.2.0, PHP 7)

DateTimeZone :: getTransitions - timezone_transitions_get - 返回时区的所有转换

Description

面向对象的风格

public array DateTimeZone::getTransitions ([ int $timestamp_begin [, int $timestamp_end ]] )

程序风格

array timezone_transitions_get ( DateTimeZone $object [, int $timestamp_begin [, int $timestamp_end ]] )

Parameters

`object`

仅限过程样式:由timezone_open()返回的DateTimeZone对象

timestamp_begin

开始时间戳。

timestamp_end

结束时间戳。

Return Values

成功返回包含关联数组的数值索引数组成功或FALSE失败。

Changelog

VersionDescription
5.3.0The optional timestamp_begin and timestamp_end were added.

Examples

Example #1 A timezone_transitions_get() example

<?php $timezone = new DateTimeZone("Europe/London" $transitions = $timezone->getTransitions( print_r(array_slice($transitions, 0, 3) ?>

上面的例子会输出类似于:

Array ( [0] => Array ( [ts] => -9223372036854775808 [time] => -292277022657-01-27T08:29:52+0000 [offset] => 3600 [isdst] => 1 [abbr] => BST ) [1] => Array ( [ts] => -1691964000 [time] => 1916-05-21T02:00:00+0000 [offset] => 3600 [isdst] => 1 [abbr] => BST ) [2] => Array ( [ts] => -1680472800 [time] => 1916-10-01T02:00:00+0000 [offset] => 0 [isdst] => [abbr] => GMT ) )

← DateTimeZone::getOffset

DateTimeZone::listAbbreviations →

© 1997–2017 The PHP Documentation Group

根据知识共享署名许可证v3.0或更高版本授权。