Richard Knop
Richard Knop

Reputation: 83697

JavaScript date object, does it use UTC by default?

When I do:

var myDate = new Date();

Does it use UTC timezone by default? Or could this vary based on client location?

Upvotes: 2

Views: 687

Answers (2)

Darren Crabb
Darren Crabb

Reputation: 580

AFAIK It takes the date and time from the machine it's running on, and it will use whatever timezone it is given from the OS, so I believe it would change based on client location, providing they have their machine set up correctly.

Upvotes: 2

xdazz
xdazz

Reputation: 160833

From MDN

If you supply no arguments, the constructor creates a JavaScript Date object for today's date and time according to local time.

It only depends on your local time.

Upvotes: 4

Related Questions