Home >Backend Development >PHP Tutorial >PHP regional time selection and setting

PHP regional time selection and setting

小云云
小云云Original
2018-03-21 13:07:502118browse

This article mainly shares with you the selection and setting of php regional time. The default time of php is European Greenwich Mean Time (Europe/Berlin), which is exactly 8 hours different.

Processing method:

1. Find the time initialization position, add, such as:

  1. date_default_timezone_set("PRC");  
    echo "time:".date("Y-m-d H:i:s",time());

2. Once and for all Settings, modify the php.ini configuration file

  1. ;date.timezone=Europe/Berlin  
    date.timezone=PRC

3. The simplest way is not to use php5.1 or above - obviously this is not advisable Method

Common settings Note:
is the People's Republic of China: PRC;
Available in mainland China: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (in order, Chongqing, Shanghai, Urumqi)
Available in Hong Kong and Taiwan: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in order, Macau, Hong Kong, Taipei)
Singapore: Asia/Singapore

The above is the detailed content of PHP regional time selection and setting. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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