Php date difference 8 small time solution. Initialization statement for adding time to the program: date_default_timezone_set (asiashanghai); definition and usage of the initialization statement for adding time to the prepare () 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
The output of the code above will be:
The above code will output the following results:
Define (asia/shanghai); define and use the date_default_timezone_set () function sets the default timezone used by all d...