Home  >  Article  >  Backend Development  >  How to change time zone in php

How to change time zone in php

hzc
hzcOriginal
2020-06-04 16:19:102514browse

How to change time zone in php

How to modify the time zone in PHP?

How to modify the time zone in PHP:

Method 1:

Add the date.timezone item found in php.ini and set the date .timezone = "Asia/Shanghai", restart the environment and it will be ok.

Method 2:

Add the time zone ini_set('date.timezone','Asia/Shanghai'); in the header of the page;

Method 3:

When you need to use these time functions, add date_default_timezone_set("PRC");

Suitable for single problem solving

Related references:PHP tutorial

The above is the detailed content of How to change time zone in php. 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