Set default time zone:
<?php date_default_timezone_set ( " Asia/Shanghai " ) ; echo date_default_timezone_get ( ) ; ?>The date_default_timezone_set() function sets the default time zone used by all date/time functions in the script.
date_default_timezone_set( timezone );
parameter | describe |
---|---|
timezone | Required. Specifies the time zone to use, such as "UTC" or "Europe/Paris". List of legal time zones: http://www.php.net/manual/en/timezones.php |
Return value: | If the timezone is illegal, return FALSE, otherwise return TRUE. |
---|---|
PHP version: | 5.1+ |
Update log: | Starting in PHP 5.1.2+, this function starts validating the timezone parameter. Starting with PHP 5.3+, E_WARNING is thrown instead of E_STRICT. |