Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does JavaScript get a new Date() from

Where does JavaScript get a new Date() from?

Is it based on the client's local computers time settings or something else?

I can't find anywhere only where this is documented. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date

like image 721
Holly Avatar asked Mar 03 '17 14:03

Holly


1 Answers

Given you don't need an internet connection to use JavaScript, it gets the current date & time (and by proxy, the UTC offset/locale) from the client's local environment. You can test this by changing your local clock.

Just remember to change it back..:)

like image 107
G0dsquad Avatar answered Oct 10 '22 00:10

G0dsquad