JavaScript Timestamp question
What does these two lines do?
Math.floor(1293859512411 / 86400000)
Math.ceil((new Date().getTime()) / 86400000)
I understand it is somethi开发者_如何学运维ng to do with time since epoch, but please explain the two lines.
Well, 86400000 is the number of milliseconds in a day - so
Math.ceil((new Date().getTime()) / 86400000)
is meant to be "the number of days elapsed since the Unix epoch at January 1st 1970 midnight UTC, rounding up".
The first line just returns the number of days between the Unix epoch and January 5th 2011.
精彩评论