downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DateTimeZone::getLocation> <DateTimeZone
[edit] Last updated: Fri, 23 Mar 2012

view this page in

DateTimeZone::__construct

timezone_open

(PHP 5 >= 5.2.0)

DateTimeZone::__construct -- timezone_openCreates new DateTimeZone object

Opis

Styl obiektowy

public DateTimeZone::__construct() ( string $timezone )

Styl proceduralny

DateTimeZone timezone_open ( string $timezone )

Creates new DateTimeZone object.

Parametry

timezone

One of timezones.

Zwracane wartości

Returns DateTimeZone on success. Styl proceduralny zwraca FALSE w przypadku niepowodzenia.

Błędy/Wyjątki

This method throws Exception if the timezone supplied is not recognised as a valid timezone.

Przykłady

Przykład #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 />';
    }
}
?>

Powyższy przykład wyświetli:

DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Mars/Phobos)
DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Jupiter/Europa)



add a note add a note User Contributed Notes DateTimeZone::__construct
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites