Home > Backend Development > PHP Tutorial > PHP date time difference 8 hours solution_PHP tutorial

PHP date time difference 8 hours solution_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:54:26
Original
1057 people have browsed it

Add time initialization statement in the program: "date_default_timezone_set("asia/shanghai");

Definition and usage

the date_default_timezone_set() function sets the default timezone used by all date/time functions.
The date_default_timezone_set() function is used to set the default time zone for all date and time functions in a script.

syntax
Grammar

date_default_timezone_set(timezone)
Copy after login

parameter
parameter
参数
description
描述
timezone required. the timezone identifier, like "utc" or "europe/paris". list of valid timezones: http://www.php教程.net/manual/en/timezones.php
必要参数,时区确认器,如“utc”或“europe/paris”。下面列出了有效的时区:http://www.php.net/manual/en/timezones.php
Parameters
description Description
timezone required. the timezone identifier, like "utc" or "europe/paris". list of valid timezones: http://www.php tutorial.net/manual/en/timezones.php
Required parameter, time zone validator, such as "utc" or "europe/paris". Valid time zones are listed below: http://www.php.net/manual/en/timezones.php


tips and notes

Note
note:

this function always returns true (even if the timezone parameter isn't valid).
Note: This function always returns true (even if the time zone parameter is invalid).


example

Case

<?phpecho(date_default_timezone_set("europe/paris"));?>
Copy after login


the output of the code above will be: The above code will output the following results:

http://www.bkjia.com/PHPjc/632328.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632328.htmlTechArticle
Add time initialization statement in the program: date_default_timezone_set(asia/shanghai); Definition and usage the date_default_timezone_set() function sets the default timezone used by all d...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template