I am working on cookies and I found some questions on Stack Overflow which have been answered. I see in the questions that the answers multiplied seconds by 1000. I want know what format getTime() returns, that would require multiplying by 1000.
Asked
Active
Viewed 3,087 times
1
-
3Because JavaScript works with time in milliseconds, not seconds. – David Thomas Oct 14 '13 at 15:18
4 Answers
9
JavaScript uses milliseconds to represent epoch time.
Epoch time is the number of seconds since 01/01/1970 and there are 1000 milliseconds in one second. So to get the number of milliseconds since 01/01/1970 you just multiply the value by 1000.
Reference -

Lix
- 47,311
- 12
- 103
- 131
-
3Since, of course, the world was created in whole in the last second of 1969. – Lee Meador Oct 14 '13 at 15:22
-
1
-
1
It's using milliseconds. That's why we need to multiply the seconds with 1000 to get an equivalent value.

opalenzuela
- 3,139
- 21
- 41