Shai UI
Shai UI

Reputation: 51958

What happens when javascript getTime() goes beyond max int?

If I do:

new Date().getTime()

I get a number of length 13

And according to What is JavaScript's highest integer value that a number can go to without losing precision?

The biggest number that can be presented is:

9007199254740991

Which is of length 16

So it's a matter of time before getTime() will go beyond the limits of integer, what happens then?

Upvotes: 3

Views: 497

Answers (1)

user149341
user149341

Reputation:

So it's a matter of time before getTime() will go beyond the limits of integer, what happens then?

That won't happen for another 285,568 years. (The value of getTime() is measured in milliseconds since the start of the year 1970.)

If humans are still around when that happens, and they're still using Javascript… well, hopefully they'll come up with some kind of workaround. :)

Upvotes: 7

Related Questions