Date_default_timezone_set specifies the China time zone. The following describes how to set the China time zone in date_default_timezone_set. if you need a simple function, refer to it. Date_default_timezone_set is used in a script. The following describes how to set date_default_timezone_set to the Chinese time zone. if you need this function, refer to it.
Date_default_timezone_set-sets the default time zone used for all date and time functions in a script.
Syntax
Bool date_default_timezone_set (string $ timezone_identifier)
Parameter description
Timezone is required. Time zone identifier, such as "UTC" or "Europe/Paris ".
Description
Note: Since PHP 5.1.0 (this version of the DATETIME function has been rewritten), if the time zone does not comply with the rules, every call to the DATETIME function will generate an E_NOTICE-level error message, if you use system settings or TZ environment variables, information at the E_STRICT level will also be generated.
Set China time zone
The code is as follows: |
|
Date_default_timezone_set ('Asia/Shanghai'); // 'Asia/Shanghai' Asia/Shanghai Date_default_timezone_set ('Asia/Chongqing '); // The value of Asia/Chongqing is "Asia/Chongqing" Date_default_timezone_set ('prc'); // PRC is "People's Republic of China" |
Note: Any of the above three methods can meet our needs.
Bytes. Date_default_timezone_set is used in a script...