Search code examples
javascriptunix-timestamptimestamp

Why do I need to multiply unix timestamps by 1000 in JavaScript?


I'm sure there's a reason I have to add three zeros to every Unix timestamp in JavaScript in order to get the correct date. Can you tell me why? Is it as simple as milliseconds since the epoch vs. seconds?


Solution

  • Because Javascript uses milliseconds internally, while normal UNIX timestamps are usually in seconds.