0

What does these two lines do?

Math.floor(1293859512411 / 86400000)
Math.ceil((new Date().getTime()) / 86400000)

I understand it is something to do with time since epoch, but please explain the two lines.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

All number in javascript are 64 bits float. Even if the number is represented with an integer looking form it's actually a float. The .0 isn't needed.
@HoLyVieR: Thanks - will just remove the last part.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.