After you find out why, you search the web for some time zone settings for PHP:
1, modify php.ini, found in the php.ini Data.timezone = remove it before the number, and then set data.timezone = "Asia/shanghai";
2, in the program PHP 5 version of the program code to use the function ini_set (' Date.timezone ', ' Asia/shanghai '), or Date_default_timezone_set ('
Today, I found a problem with the time judgment statement in a piece of PHP code. after studying it, I found that the problem lies in the time zone settings in PHP. the default time taken by PHP is Greenwich Mean Time, after 8 hou
After finding the cause, I found some methods for setting the time zone of PHP on the Internet:
1. Modify php. ini, find data. timezone = in php. ini, remove the; sign, and set data. timezone = "Asia/Shanghai.
2. Use the ini_set function ('date. timezone ', 'Asia/Shanghai') in the program code of PHP version 5 or later; or date_default_timezone_set ('Asia/Shangh
This article mainly introduces the difference between date and gmdate in PHP and the default time zone settings. For more information, see
I. What is the difference between date and gmdate?The PHP time function has two formatting functions: date () and gmdate (). the descriptions in the official documents are:
The code
After finding the cause, I found some methods for setting the time zone of PHP on the Internet:1. Modify php. ini, find data. timezone = in php. ini, remove the; sign, and set data. timezone = "Asia/Shanghai.2. Use the ini_set function ('date. timezone ', 'Asia/Shanghai') in the program code of PHP version 5 or later; or date_default_timezone_set ('Asia/Shanghai
shows the use of timezone in date. The Reference code is as follows (Timezonetest.java):
Import Java.text.DateFormat;
Import Java.util.Date;
Import Java.util.TimeZone;
/** * TimeZone test program/public class Timezonetest {public static void main (string[] args) {//test 3 ways to create a TimeZone object
Showusageoftimezones ();
Test TimeZone other API Testotherapis ();
Print all ID//printalltimezones () supported by getTimeZone (Strin
What is the difference between date and gmdate?There are two formatting functions in the PHP time function: Date () and Gmdate (), which are described in the official documentation as:
Copy Code code as follows:
Date () #-format a local time/date
Gmdate () #-formats a GMT/UTC date/
AEST specified Alian Eastern Standard Time, defined as UTC + 10 hours
AEDT extends Alian Eastern Daylight Time, defined as UTC + 11 hours
ACST extends Alian Central Standard Time, defined as UTC + 9.5 hours
ACDT clock Alian Central Daylight Time, defined as UTC + 10.5 hours
AWST specified Alian Western
Today, I found a problem with the time judgment statement in a piece of PHP code. after studying it, I found that the problem lies in the time zone settings in PHP. the default time taken by PHP is Greenwich Mean Time, after 8 hou
When a user of an application is spread all over the world, the Code of the program is not necessarily dealing with the time zone. The server-side timing task for the user needs to be set to the time zone of the user.
In glow nurture, a typical example is: If the user does
How to set the time zone in php. The default time zone of php is in Europe and America, so it is 8 hours different from our China time zone. next I will introduce you to the php time
PHP default time zone is Europe and the United States, so with our Chinese time zone a full 8 hours, oh, let me introduce you to the PHP set time zone method, there is a need to know the friends can enter the reference.
In php.ini
specified, this is like today (), but, if possible, supplies more precision than can be gotten from going through a time. time () timestamp (for example, this may be possible on platforms supplying the C gettimeofday () function ).
Else tz must be an instance of a class tzinfo subclass, and the current date and time are converted to tz's
built in PHP can help solve this problem, but these functions are not intuitive and require some time to familiarize themselves with their use. A quicker option, of course, is to use the Date class library of pear, which has built-in support for time zones, and so far it is the easiest way to do time zone conversions.
Available values in mainland China: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (in the order of Chongqing, Shanghai, and Urumqi)Available in Hong Kong and Taiwan regions: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei)Singapore: Asia/SingaporeOther available values are: Etc/GMT-8, Singapore, Hongkong, PRC1. Set the time zone in Linux. Take CentOS5.5 as an example: The
Http://www.pool.ntp.org/en/ time servers worldwide
Set and modify centos System Time Zone
When we use the centos system, problems may occur frequently in the time zone, and sometimes errors may occur after the change. Next we will learn a way to change this situation. If yo
permission to modify the configuration file, you can set the time zone to do so by modifying the Date.timezone property in PHP.ini. We can set the value of this property to one of the "Asia/shang", "asia/chongqing", "etc/gmt-8", or PRC, and then the current time in the PHP script is Beijing time. Modify PHP's configur
the month, day, in world Standard Time (UTC) in the Date object, and returns the number of milliseconds (timestamp) between the Date object and the midnight of January 1, 1970setUTCSeconds () function--sets the seconds, milliseconds, in world standard Time (UTC) in the Date object, and returns the number of milliseconds (timestamp) between the Date object and the midnight of January 1, 1970In the
The Default Time Zone of php is in Europe and America, so it is 8 hours different from our China time zone. Next I will introduce you to the php Time Zone setting method. If you need to know about it, please refer to it.
In php. i
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.