最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

does the javascript date object use the system clock? - Stack Overflow

programmeradmin4浏览0评论

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?

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?

Share Improve this question asked May 6, 2011 at 9:14 johnjohn 35.4k12 gold badges48 silver badges62 bronze badges 1
  • 1 I am curious what you think it would have been based off of if not the system clock. :) – epascarello Commented May 6, 2011 at 9:21
Add a comment  | 

2 Answers 2

Reset to default 15

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.

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.

发布评论

评论列表(0)

  1. 暂无评论