Home  >  Article  >  Backend Development  >  How to set time zone in php?

How to set time zone in php?

王林
王林Original
2019-09-21 11:49:0716364browse

How to set time zone in php?

Methods and steps for setting time zone in PHP

1. Create a php file named date_default_timezone_set

How to set time zone in php?

2. Add a date_default_timezone_set function and add the "Asia/Shanghai" character Put the string into the function and set the Asia Shanghai time zone

How to set time zone in php?

## 3. Print the current time year, month, day, hour, minute and second of the time zone

How to set time zone in php?

##4. Add a date_default_timezone_set function and put the "America/New_York" string into the function to set the New York time zone

How to set time zone in php?

5. Add a date_default_timezone_set function and put the "Europe/Berlin" string into the function to set the Berlin time zone

How to set time zone in php?

#6. Add a date_default_timezone_set function and put the "Africa/tunis" string into the function, Set Tunisia time zone

How to set time zone in php?

##7. Run this in the browser The file displays the time in the region displayed in different time zones

How to set time zone in php?##Recommended tutorial:PHP video tutorial

The above is the detailed content of How to set 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
Previous article:what php can doNext article:what php can do