datetimezone.__construct(3) php man page | unix.com

Man Page: datetimezone.__construct

Operating Environment: php

Section: 3

DATETIMEZONE.__CONSTRUCT(3)						 1					       DATETIMEZONE.__CONSTRUCT(3)

DateTimeZone::__construct - Creates new DateTimeZone object

       Object oriented style

SYNOPSIS
public DateTimeZone::__construct (string $timezone)
DESCRIPTION
Procedural style DateTimeZone timezone_open (string $timezone) Creates new DateTimeZone object.
PARAMETERS
o $timezone - One of the supported timezone names.
RETURN VALUES
Returns DateTimeZone on success. Procedural style returns FALSE on failure.
ERRORS
/EXCEPTIONS This method throws Exception if the timezone supplied is not recognised as a valid timezone.
EXAMPLES
Example #1 Catching errors when instantiating DateTimeZone <?php // Error handling by catching exceptions $timezones = array('Europe/London', 'Mars/Phobos', 'Jupiter/Europa'); foreach ($timezones as $tz) { try { $mars = new DateTimeZone($tz); } catch(Exception $e) { echo $e->getMessage() . '<br />'; } } ?> The above example will output: DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Mars/Phobos) DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Jupiter/Europa) PHP Documentation Group DATETIMEZONE.__CONSTRUCT(3)
Related Man Pages
datetime.__construct(3) - php
datetime.getlasterrors(3) - php
intltimezone(3) - php
datefmt_set_timezone(3) - php
mongocommandcursor.__construct(3) - php
Similar Topics in the Unix Linux Community
New Code Tags (Syntax Highlighting)
Status of UNIX.COM Forum Transformation
Please Welcome Ravinder Singh to the Moderation Team
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Don Cragun
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Wolf Machowitsch