How to set php time zone to Berlin?

青灯夜游
Release: 2023-03-06 08:16:02
Original
2312 people have browsed it

Method: 1. In the php.ini configuration file, set "date.timezone="Europe/Berlin"" and restart the environment; 2. Use "ini_set('date.timezone' in the header of the PHP page ,'Europe/Berlin')" to set the time zone.

How to set php time zone to Berlin?

Recommended: "PHP Video Tutorial"

Three ways to set Berlin time zone in PHP

Method 1:

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

Method 2:

When you need to use these time functions, add date_default_timezone_set("Europe/Berlin");# to the page

##Method 3:

Add setting time zone to the header of the page

ini_set('date.timezone','Europe/Berlin');

List of legal time zones: http://www.php.net/manual/en/timezones.php

Summary, methods one and three generally require server permissions is more effective, and method 2 allows technicians to control the current page, which is also a more commonly used method among programmers.

Related recommendations:

php training

The above is the detailed content of How to set php time zone to Berlin?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!