phpday 2027 - Call for Papers

The DateTimeZone class

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

Introduction

Representation of time zone.

Class synopsis

class DateTimeZone {
/* Constants */
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;
/* Methods */
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
}

Predefined Constants

DateTimeZone::AFRICA int

Africa time zones.

DateTimeZone::AMERICA int

America time zones.

DateTimeZone::ANTARCTICA int

Antarctica time zones.

DateTimeZone::ARCTIC int

Arctic time zones.

DateTimeZone::ASIA int

Asia time zones.

DateTimeZone::ATLANTIC int

Atlantic time zones.

DateTimeZone::AUSTRALIA int

Australia time zones.

DateTimeZone::EUROPE int

Europe time zones.

DateTimeZone::INDIAN int

Indian time zones.

DateTimeZone::PACIFIC int

Pacific time zones.

DateTimeZone::UTC int

UTC time zones.

DateTimeZone::ALL int

All time zones.

DateTimeZone::ALL_WITH_BC int

All time zones including backwards compatible.

DateTimeZone::PER_COUNTRY int

Time zones per country.

Changelog

Version Description
8.4.0 The class constants are now typed.

Table of Contents

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top