Strtotime (Date ("y-m-01 00:00:00")); Used to get the first day of the month time stamp
In the actual PHP strtotime application suddenly once encountered the conversion time is 8 hours slower than the actual time! I thought it was in php.ini.
TimeZone Setup error caused, patrol a lap finally locked the problem on the Strtotime function (Linux server is often a problem, the Windows server returned the data is basically correct)
Read the PHP manual carefully and find that the first parameter has a format requirement
Time
The string to parse, according to the gnu»date Input Formats syntax. Before PHP 5.0.0, microseconds weren ' t allowed in the time, since PHP 5.0.0 they is allowed but ignored.
Further follow-up discovery of Date Input Formats
$ lc_all=c tz=utc0 Date
Mon Mar 1 00:21:42 UTC 2004
$ tz=utc0 Date + '%y-%m-%d%h:%m:%sz '
2004-03-01 00:21:42z
$ Date--iso-8601=ns | TR T ' #--iso-8601 is a GNU extension.
2004-02-29 16:21:42,692722128-0800
$ date--rfc-2822 # a GNU extension
Sun, Feb 2004 16:21:42-0800
$ date + '%y-%m-%d%h:%m:%s%z ' #%z is a GNU extension.
2004-02-29 16:21:42-0800
$ date + ' @%s.%n ' #%s and%N are GNU extensions.
@1078100502.692722128
Find our usual format Yyyy-mm-dd HH:II:SS does not meet the requirements. After a rough look, decide to use the UTC0 format to update the above code with the following code
Strtotime (Date ("Y-m-01 00:00:00"). " Z "); Used to get the first day of the month time stamp
Solve this problem!
PHP Strtotime Application Summary:
We were sometimes supported by the system during the development process and overlooked some of the details. As this example in the Windows platform does not have this problem, but the PHP strtotime application still need to follow the specification will be better. To avoid such problems.
http://www.bkjia.com/PHPjc/445988.html www.bkjia.com true http://www.bkjia.com/PHPjc/445988.html techarticle strtotime (Date (y-m-01 00:00:00));//used to get the first day of the month time stamp in the actual PHP strtotime application suddenly once encountered the conversion over time is 8 hours slower than the actual time ...