I recently configured a server in a wamp environment, but I found that the time is different from the local time, and the time obtained by using time and then using date displays a time difference. Let's take a look at the causes and solutions.
If the date time is inconsistent, you can use date_default_timezone_set to set the time zone:
The code is as follows
|
Copy code | ||||
";
//Calculate the current time
echo date('Y-m-d H:i:s',time()-600); //Subtract 10 hours
echo " "; //Timestamp to time echo date('Y-m-d H:i:s',1364277600); //Convert time to timestamp (accurate to seconds only) echo strtotime("2013-03-26 14:00"); echo " "; ?> Another way is to modify the configuration file in php.ini date_default_timezone_set('PRC'); No return value. It’s OK to use the date function directly below |
$time = date(Y."Year".m."Month".d."Day".G."Hour".i."Min");
http: //www.bkjia.com/PHPjc/632715.html