Add time initialization statement in 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.
date_default_timezone_set(timezone) Copy after login |
parameter
|
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, time zone validator, such as "utc" or "europe/paris". Valid time zones are listed below: http://www.php.net/manual/en/timezones.php |
Note
note:
Case
<?phpecho(date_default_timezone_set("europe/paris"));?> Copy after login |