php date_default_timezone_set

WBOY
Release: 2016-08-08 09:27:43
Original
2720 people have browsed it

date_default_timezone_set('PRC')

Get the time zone and set the time and time zone in the script

Source code:


Date_default_timezone_set('PRC');
echo "China Beijing time :";
echo date("y-m-d h:i:s")."
";

date_default_timezone_set('America/New_York');
echo "New York time:";
echo date("y-m-d h:i:s")
?>
Output:

The two echoes are different and correspond to their respective time zones.

If you cancel date_default_timezone_set(xxx), you can get Beijing time (get both)

The following is how to get China time zone

date_default_timezone_set('Asia/Shanghai');//'Asia/Shanghai' Asia/Shanghai

date_default_timezone_set('Asia/Chongqing');//where Asia/Chongqing' is "Asia/Chongqing"

date_default_timezone_set('Asia/Harbin');//where 'Asia/Harbin' is "Asia/Harbin"

date_default_timezone_set('PRC');//where PRC is "People's Republic of China"


The above introduces php date_default_timezone_set, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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