Copy code The code is as follows:
date_default_timezone_set("ETC/GMT-8");
$ tm=time();
echo date("Y-m-d h:i a",$tm);
echo "
";
echo date(" Y year m month d day",$tm);
?>
PHP default time zone UTC time zone, and Beijing is located in the east eighth district of this time zone, 8 times ahead of UTC time zone hours, so the current time obtained using the time() function in PHP is always 8 hours different.
can be configured in the following two ways:
1. Modify the value of date.timezone in the php.ini file
2. Use special Function to set time zone, date_default_timezone_set("ETC/GMT-8");
http://www.bkjia.com/PHPjc/313671.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313671.htmlTechArticleCopy the code as follows: ? date_default_timezone_set("ETC/GMT-8"); $tm=time(); echo date("Y-m-d h:i a",$tm); echo "br/br/"; echo date("Y year m month d day",$tm); ? PHP default time zone UTC time...