0

I'm using ubuntu for serving my website and I've used Date.now() a couple of times to get the current date. I live in Beirut (which is around 12:40 PM right now) and Date.now() is logging minus 2 hours (10:40 PM).
I changed the localtime of ubuntu by doing this command:

sudo dpkg-reconfigure tzdata

It's printing this:

Local time is now:      Tue Feb 27 12:40:59 EET 2018.
Universal Time is now:  Tue Feb 27 10:40:59 UTC 2018.

But it still doesn't work.
Basically, I want Date.now() to target the local time instead of universal one...

Cedric Hadjian
  • 849
  • 12
  • 25

1 Answers1

0

Date.now() returns the milliseconds elapsed since the UNIX epoch, and has no concept of timezone whatsoever.

Jiby Jose
  • 3,745
  • 4
  • 24
  • 32