Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Javascript use the local computer time?

This may be a dumb question, I'm 99% sure it does, but I need to be sure... does JS use the local computer's time?

like image 683
Webnet Avatar asked Nov 20 '10 19:11

Webnet


2 Answers

Yes it does use the computer's local time. To test, change your computer time and it will reflect in new Date

like image 71
meder omuraliev Avatar answered Oct 03 '22 02:10

meder omuraliev


It'll use the time on whatever computer is running the code.

In most cases, that's in a web browser on a client computer, so it'll use whatever time the web browser sees. This is most likely the computer's local time (unless the browser is doing something weird, which most don't and I've never seen).

Note that if you're using something like node.js and running server-side Javascript then it'll use the local time for that computer instead :)

like image 24
David Avatar answered Oct 03 '22 01:10

David