After loading the PHP5 you will find this problem:
You may find that the output time is not the same as your current time.
The reason is that if you do not set your server local time zone in the program or configuration file, the time taken by PHP is Greenwich Mean time, so there will be a discrepancy with your local time.
Greenwich Mean Time and Beijing time is about 8 hours. So how do we avoid time errors?
Let's take a look at the workaround:
In the header, use Date_default_timezone_set () to set my default time zone to Beijing time.
The time is the same as the current time of the server.
Make sure that the H in date (' y-m-d h:i:s ') is uppercase if an Insert database error occurs.
Additional Date_default_timezone_set usage is as follows:
Date_default_timezone_set
(PHP 5 >= 5.1.0rc1)
Date_default_timezone_set--Set the default time zone for all datetime functions in a script
Description
BOOL Date_default_timezone_set (String timezone_identifier)
Date_default_timezone_set () Sets the default time zone for all datetime functions.
Note: Since PHP 5.1.0 (This version of the date time function is rewritten), each call to a DateTime function will produce an E_notice level error message if the time zone is not in law.
Parameters
Timezone_identifier
Time zone identifiers, such as UTC or Europe/lisbon
return value
This function always returns TRUE (even if the timezone_identifier argument is not valid).
or modify the Date.timezone value in php.ini, Date.timezone = PRC
http://www.bkjia.com/PHPjc/752579.html www.bkjia.com true http://www.bkjia.com/PHPjc/752579.html techarticle after loading the PHP5 you will find the question: Php$atime=date ("y-m-d h:i:s"); Echo $atime; > You may find that the output time is not the same as your current time. The reason is that if you ...