The initialization statement for adding time to the program: "date_default_timezone_set (" asia/shanghai ");
Definition and usage
The date_default_timezone_set () function sets the default timezone used by all date/time functions.
The date_default_timezone_set () function is used to set the default time zone for all date and time functions in a script.
Syntax
Syntax
date_default_timezone_set(timezone) |
Parameter Parameters |
Description Description |
Timezone |
Required. the timezone identifier, like "utc" or "europe/paris". list of valid timezones: http://www.php tutorial. net/manual/en/timezones. php Required parameter, such as utc or europe/paris ". The following lists valid time zones: http://www.php.net/manual/en/timezones.php |
Tips tutorial and notes
Notes
Note:This function always returns true (even if the timezone parameter isn't valid ).
Note: This function always returns true (even if the time zone parameter is invalid ).
Example
Case
<?phpecho(date_default_timezone_set("europe/paris"));?> |
The output of the code above will be:
The above code will output the following results: