The related setting is to modify the Date.timezone parameters in php.ini:
[Date]
; Defines the default timezone used by the date functions
;d Ate.timezone =
The default is off, just remove the annotation and change it to
[Date]
; Defines the default timezone used by the date functions
Date.timezone = PRC
Which PRC is the "People's Republic of China"!
Other options refer to the PHP manual.
But this Asian region has missed our capital Beijing, do not know the foreigner is not intentional!
If you do not modify the permissions of the php.ini, simply call the time-date function by calling Date_default_timezone_set ('
PRC ') can!
You can also call Date_default_timezone_get () to view the current time zone settings!
For XXX, the available values in the mainland are:
Asia/chongqing, Asia/shanghai, Asia/urumqi (in turn, celebration, Shanghai, Uruguayan)
Hong Kong and Taiwan areas available: Asia/macao, Asia/hong_kong, Asia/taipei (in turn, Macau, Hongkong, Taipei)
Taiwan area can be designed as: Date.timezone = "Asia//taipei"
and Singapore: Asia/singapore
Eight-hour time difference in PHP5 solution
Install good php5, in the forum inadvertently, in the forum to see someone say php5.1.2 time show a full less than 8 hours,
<?php
echo Date ("y-m-d h:i:s");
?>
The results of their own test is exactly 8 hours difference.
Later, after the forum to find information, the results finally resolved, in PHP5 and above the version, to output local time (limited China)
, you can write code like this:
<?php
Date_default_timezone_set (' Asia/shanghai ');
echo Date (' y-m-d h:i:s ');
?>
You can also write code like this:
<?php
Date_default_timezone_set (' asia/chongqing ');
echo Date (' y-m-d h:i:s ');
?>
This time difference of eight hours problem solved!! ~~~
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.