A brief introduction to date.timezone settings in php.ini

墨辰丷
Release: 2023-03-28 14:16:02
Original
1845 people have browsed it

This article will share with you the method of setting date.timezone in php.ini. It is very simple and practical. Friends in need can refer to it

date.timezoneSetting php5 The default date.timezone is utc. Changing it to date.timezone = PRC can solve the problem of eight hours difference in time. However, I looked at the official documentation of PHP for a long time and could not find this parameter.

Although I know this The parameter means "People's Republic of China", but there is no such parameter in the official documents. There are only parameters such as Asia/Shanghai, Asia/Hong_Kong, etc. Why can it be set to RPC here? Can anyone give me some advice? What exactly is this parameter? Where? It seems that there is indeed no such parameter in the official documents, I am confused. Generally, it is set to Asia/Shanghai

. I have been using xampp for a while. Today, in order to correct the php acquisition function, it is to obtain the server time.

Since php5.1.0, the date.timezone option has been added to php.ini, which is turned off by default. The displayed time is all Greenwich Mean Time, which is exactly 8 hours different from Beijing time.

Method found online:

Modify the php.ini file, search for ;date.timezone =, remove the semicolon in front and add the time zone after "=".

For example: Asia/Chongqing (Chongqing), Asia/Shanghai (Shanghai), Asia/Urumqi (Urumqi), Asia/Macao (Macao), Asia/Hong_Kong (Hong Kong), Asia/Taipei (Taipei), PRC

Example

;date.timezone =

Change to:

date.timezone = Asia/Shanghai

The method is very simple. But under xampp, changing the php/php.ini file has no effect. Later, I searched online and found out that damn xampp, put php.ini under apache/bin and modify the php.ini in this to be useful.

The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

PHP method to import csv files into mysql database

PHP implements conversion between ASCII code and string

Complete method of DES encryption, decryption and packaging class implemented by PHP

The above is the detailed content of A brief introduction to date.timezone settings in php.ini. 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