大网数据广告活动
PHP 语言与运行手册

DateTimeZone 类

· 52CE 我爱测

DateTimeZone 类

DateTimeZone 类

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

简介

时区表示。

类摘要

class DateTimeZone {
/* 常量 */
public const int AFRICA;
public const int AMERICA;
public const int ANTARCTICA;
public const int ARCTIC;
public const int ASIA;
public const int ATLANTIC;
public const int AUSTRALIA;
public const int EUROPE;
public const int INDIAN;
public const int PACIFIC;
public const int UTC;
public const int ALL;
public const int ALL_WITH_BC;
public const int PER_COUNTRY;
/* 方法 */
public function __construct(string $timezone)
public function getLocation(): array|false
public function getName(): string
public function getOffset(DateTimeInterface $datetime): int
public function getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = 2147483647): array|false
public static function listAbbreviations(): array
public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array
}

预定义常量

DateTimeZone::AFRICA int

非洲时区。

DateTimeZone::AMERICA int

美洲时区。

DateTimeZone::ANTARCTICA int

南极洲时区。

DateTimeZone::ARCTIC int

北极时区。

DateTimeZone::ASIA int

亚洲时区。

DateTimeZone::ATLANTIC int

大西洋时区。

DateTimeZone::AUSTRALIA int

澳洲时区。

DateTimeZone::EUROPE int

欧洲时区。

DateTimeZone::INDIAN int

印度洋(Indian)时区。

DateTimeZone::PACIFIC int

太平洋时区。

DateTimeZone::UTC int

UTC 时区。

DateTimeZone::ALL int

所有时区。

DateTimeZone::ALL_WITH_BC int

所有时区,包含向后兼容。

DateTimeZone::PER_COUNTRY int

每个国家的时区。

更新日志

版本 说明
8.4.0 类常量现已类型化。

目录

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。