The time stamp in PHP is compared to the timestamp in JavaScript, in essence, they are the same thing, but if the two want to make an equal comparison, or a little different, a little attention, will go astray, so, here list easily overlooked two points different, for everyone to refer to:
1 unit problem: in PHP when the timestamp, mostly through the time () method to obtain, it gets the value is in seconds as the unit, and JavaScript from the Date object in the GetTime () method to obtain the value is in milliseconds, so, to compare their obtained Time is the same day, you must pay attention to their units converted to the same, 1 seconds =1000 milliseconds, the remaining, you understand, hehe.
2 time zone problem: The 1th said that in PHP, the time () method to obtain the timestamp, through the convenience of display, we will set up the current server in the PHP code time zone, such as the Chinese mainland server will normally be set into the East eight area, so the same, time () The method obtained is no longer from January 1, 1970 0:0 0 seconds, but from January 1, 1970 8:0 0 seconds, and JS usually does not make time zone related settings, so the January 1, 1970 0:0 0 seconds for the calculation of the starting point, so it is easy to create inconsistencies in this place.
Materialism tells us to look at nature through the phenomena of things, two timestamps, essentially, is the year, month, day, time, minutes, seconds of the combination of results, if the actual appearance and the expected results do not conform to its method, the best way is to their year, month, day and other values are lost, one by one comparison, it is easy to find the problem.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/