Strtotime (date ("Y-m-01 00:00:00"); // used to get the first day of the month Timestamp
In the actual PHP strtotime application, the conversion time is suddenly eight hours slower than the actual time! I thought it was in php. ini.
The timezone settings are incorrect. After a circle is inspected, the problem is finally locked to the strtotime function (the linux server usually has problems and the data returned by the WINDOWS Server is basically correct)
I carefully read the PHP manual and found that the first parameter time 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 are allowed but ignored.
Through further follow-up 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.
16:21:42, 692722128-0800
$ Date -- rfc-2822 # a GNU extension
Sun, 29 Feb 2004 16:21:42-0800
$ Date + '% Y-% m-% d % H: % M: % S % Z' # % z is a GNU extension.
16:21:42-0800
$ Date + '@ % s. % n' # % s and % N are GNU extensions.
1078100502.692722128
We found that the commonly used format yyyy-mm-dd HH: ii: ss does not meet the requirements. After reading it, I decided to use the UTC0 format to update the above Code to the following code.
Strtotime (date ("Y-m-01 00:00:00"). "Z"); // used to get the first day of the month Timestamp
Now the problem is solved!
PHP strtotime application summary:
Some details are sometimes ignored by the system during the development process. In this case, this problem does not occur on the WINDOWS platform, but the PHP strtotime application should follow the standard. To avoid such problems.