(PHP 5 >= 5.2.0, PHP 7)
DateTimeZone::__construct -- timezone_open — �����µ�DateTimeZone����
���������
$timezone
)���̻����
�����µ�DateTimeZone����.
�ɹ�ʱ���� DateTimeZone����.
���̻������ʧ��ʱ���� FALSE
��
����ṩ��ʱ����Ч���˷������׳� Exception�쳣.
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 />';
}
}
?>
�������̻������
DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Mars/Phobos) DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Jupiter/Europa)