12

e.g., if you had:

var d = new Date();
alert(d.getTime());

is it based on the system clock? if i change the time/date on my computer's clock, am i potentially sending erroneous data back to my server?

john
  • 33,520
  • 12
  • 45
  • 62

2 Answers2

14

This uses the system time on the client computer where this javascript is executed. So if you change the date/time on the client computer it will send the new value to the server.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
5

Yes, it uses the system time on the client side.

When posting data, you don't need to post the date of the request (which I think it what you are trying to do), just get the current date (server side) when the post request is made and use this as your date.

Tom Gullen
  • 61,249
  • 84
  • 283
  • 456