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

PHP regional time selection and setting

小云云
Release: 2023-03-21 20:42:01
Original
2134 people have browsed it

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());
    Copy after login

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

  1. ;date.timezone=Europe/Berlin  
    date.timezone=PRC
    Copy after login

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!

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