How to use the php output time format. Copy the code as follows :? Date_default_timezone_set (ETCGMT-8); $ tmtime (); echodate (Y-m-dh: ia, $ tm); echobrbr; echodate (Y-m-D, $ tm );? When the default time zone of PHP is UTC
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-m-D", $ tm );
?>
The default time zone of PHP is UTC, while Beijing is located in the GMT + 8, which is eight hours ahead of the UTC time zone. therefore, time () is used in PHP () the current time obtained by the function is always 8 hours different.
You can configure it in either of the following ways:
1. modify the value of date. timezone in the php. ini file
2. use a function that specifically sets the time zone, date_default_timezone_set ("ETC/GMT-8 ");
The http://www.bkjia.com/PHPjc/313671.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/313671.htmlTechArticle code is as follows :? Date_default_timezone_set ("ETC/GMT-8"); $ tm = time (); echo date ("Y-m-d h: I a", $ tm ); echo "br/"; echo date ("Y, m, d", $ tm );? PHP default time zone UTC...