How to use php to output time format_PHP tutorial

WBOY
Release: 2016-07-21 16:12:14
Original
805 people have browsed it

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");

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template