Search code examples
javascriptnode.jsdateutc

Is Date.now() in local milliseconds since epoch, or milliseconds since epoch in UTC time


I have the impression Date.now() is milliseconds since epoch in our local time zone. If that's the case, how can I get milliseconds since epoch in UTC time? This would be the long way I guess:

new Date(new Date().toUTCString()).getTime()

is there a faster way?


Solution

  • Date.now() and new Date().getTime() use UTC for time representation.