首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

DateTimeZone (class)

Introduction

(PHP 5 >= 5.2.0, PHP 7)

时区的表示。

课程简介

DateTimeZone {

/* Constants */

const integer AFRICA = 1 ;

const integer AMERICA = 2 ;

const integer ANTARCTICA = 4 ;

const integer ARCTIC = 8 ;

const integer ASIA = 16 ;

const integer ATLANTIC = 32 ;

const integer AUSTRALIA = 64 ;

const integer EUROPE = 128 ;

const integer INDIAN = 256 ;

const integer PACIFIC = 512 ;

const integer UTC = 1024 ;

const integer ALL = 2047 ;

const integer ALL_WITH_BC = 4095 ;

const integer PER_COUNTRY = 4096 ;

/* Methods */

public __construct ( string $timezone )

代码语言:javascript
复制
public array getLocation ( void )
代码语言:javascript
复制
public string getName ( void )
代码语言:javascript
复制
public int getOffset ( DateTime $datetime )
代码语言:javascript
复制
public array getTransitions ([ int $timestamp_begin [, int $timestamp_end ]] )
代码语言:javascript
复制
public static array listAbbreviations ( void )
代码语言:javascript
复制
public static array listIdentifiers ([ int $what = DateTimeZone::ALL [, string $country = NULL ]] )

}

预定义的常量

DateTimeZone::AFRICA

非洲时区。

DateTimeZone::AMERICA

美国时区。

DateTimeZone::ANTARCTICA

南极洲时区。

DateTimeZone::ARCTIC

北极时区。

DateTimeZone::ASIA

亚洲时区。

DateTimeZone::ATLANTIC

大西洋时区。

DateTimeZone::AUSTRALIA

澳大利亚时区。

DateTimeZone::EUROPE

欧洲时区。

DateTimeZone::INDIAN

印度时区。

DateTimeZone::PACIFIC

太平洋时区。

DateTimeZone::UTC

UTC时区。

DateTimeZone::ALL

所有时区。

DateTimeZone::ALL_WITH_BC

所有时区包括向后兼容。

DateTimeZone::PER_COUNTRY

每个国家的时区。

目录

  • DateTimeZone :: __ construct - 创建新的DateTimeZone对象
  • DateTimeZone :: getLocation - 返回时区的位置信息
  • DateTimeZone :: getName - 返回时区的名称
  • DateTimeZone :: getOffset - 返回GMT的时区偏移量
  • DateTimeZone :: getTransitions - 返回时区的所有转换
  • DateTimeZone :: listAbbreviations - 返回包含dst,offset和时区名称的关联数组
  • DateTimeZone :: listIdentifiers - 返回包含所有已定义时区标识符的数字索引数组

←DateTime :: __唤醒

DateTimeZone::__construct →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com