Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

datetimezone(3) [php man page]

DATETIMEZONE(3) 							 1							   DATETIMEZONE(3)

The DateTimeZone class

INTRODUCTION
Representation of time zone. CLASS SYNOPSIS
DateTimeZone DateTimeZone Constants o const integer$DateTimeZone::AFRICA1 o const integer$DateTimeZone::AMERICA2 o const integer$DateTimeZone::ANTARCTICA4 o const integer$DateTimeZone::ARCTIC8 o const integer$DateTimeZone::ASIA16 o const integer$DateTimeZone::ATLANTIC32 o const integer$DateTimeZone::AUSTRALIA64 o const integer$DateTimeZone::EUROPE128 o const integer$DateTimeZone::INDIAN256 o const integer$DateTimeZone::PACIFIC512 o const integer$DateTimeZone::UTC1024 o const integer$DateTimeZone::ALL2047 o const integer$DateTimeZone::ALL_WITH_BC4095 o const integer$DateTimeZone::PER_COUNTRY4096 Methods o public DateTimeZone::__construct (string $timezone) o public array DateTimeZone::getLocation (void ) o public string DateTimeZone::getName (void ) o public int DateTimeZone::getOffset (DateTime $datetime) o public array DateTimeZone::getTransitions ([int $timestamp_begin], [int $timestamp_end]) o publicstatic array DateTimeZone::listAbbreviations (void ) o publicstatic array DateTimeZone::listIdentifiers NULL ([int $what = DateTimeZone::ALL], [string $country]) PREDEFINED CONSTANTS
o DateTimeZone::AFRICA -Africa time zones. o DateTimeZone::AMERICA -America time zones. o DateTimeZone::ANTARCTICA -Antarctica time zones. o DateTimeZone::ARCTIC -Arctic time zones. o DateTimeZone::ASIA -Asia time zones. o DateTimeZone::ATLANTIC -Atlantic time zones. o DateTimeZone::AUSTRALIA -Australia time zones. o DateTimeZone::EUROPE -Europe time zones. o DateTimeZone::INDIAN -Indian time zones. o DateTimeZone::PACIFIC -Pacific time zones. o DateTimeZone::UTC -UTC time zones. o DateTimeZone::ALL -All time zones. o DateTimeZone::ALL_WITH_BC -All time zones including backwards compatible. o DateTimeZone::PER_COUNTRY -Time zones per country. PHP Documentation Group DATETIMEZONE(3)

Check Out this Related Man Page

DATETIME.__CONSTRUCT(3) 						 1						   DATETIME.__CONSTRUCT(3)

DateTime::__construct - Returns new DateTime object

       Object oriented style

SYNOPSIS
public DateTime::__construct NULL ([string $time = "now"], [DateTimeZone $timezone]) DESCRIPTION
Procedural style DateTime date_create NULL ([string $time = "now"], [DateTimeZone $timezone]) Returns new DateTime object. PARAMETERS
o $time -A date/time string. Valid formats are explained in Date and Time Formats. Enter NULL here to obtain the current time when using the $timezone parameter. o $timezone - A DateTimeZone object representing the timezone of $time. If $timezone is omitted, the current timezone will be used. Note The $timezone parameter and the current timezone are ignored when the $time parameter either is a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00). RETURN VALUES
Returns a new DateTime instance. Procedural style returns FALSE on failure. ERRORS
/EXCEPTIONS Emits Exception in case of an error. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | If $time contains an invalid date/time format, | | | then an exception is now thrown. Previously an | | | error was emitted. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.__construct(3) example Object oriented style <?php try { $date = new DateTime('2000-01-01'); } catch (Exception $e) { echo $e->getMessage(); exit(1); } echo $date->format('Y-m-d'); ?> Procedural style <?php $date = date_create('2000-01-01'); if (!$date) { $e = date_get_last_errors(); foreach ($e['errors'] as $error) { echo "$error "; } exit(1); } echo date_format($date, 'Y-m-d'); ?> The above examples will output: 2000-01-01 Example #2 Intricacies of DateTime.__construct(3) <?php // Specified date/time in your computer's time zone. $date = new DateTime('2000-01-01'); echo $date->format('Y-m-d H:i:sP') . " "; // Specified date/time in the specified time zone. $date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . " "; // Current date/time in your computer's time zone. $date = new DateTime(); echo $date->format('Y-m-d H:i:sP') . " "; // Current date/time in the specified time zone. $date = new DateTime(null, new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . " "; // Using a UNIX timestamp. Notice the result is in the UTC time zone. $date = new DateTime('@946684800'); echo $date->format('Y-m-d H:i:sP') . " "; // Non-existent values roll over. $date = new DateTime('2000-02-30'); echo $date->format('Y-m-d H:i:sP') . " "; ?> The above example will output something similar to: 2000-01-01 00:00:00-05:00 2000-01-01 00:00:00+12:00 2010-04-24 10:24:16-04:00 2010-04-25 02:24:16+12:00 2000-01-01 00:00:00+00:00 2000-03-01 00:00:00-05:00 SEE ALSO
DateTime.createFromFormat(3), DateTimeZone.__construct(3), Date and Time Formats, date.timezone ini setting, date_default_time- zone_set(3), DateTime.getLastErrors(3), checkdate(3). PHP Documentation Group DATETIME.__CONSTRUCT(3)
Man Page