0

hi i m making a website in which the user has to enter data on current or next days not of previous days.
but if the user changes the date of their system,they r able to enter data of previous day also.
is there any way in which i can get the date of server so that even if the user changes his computer date it does not effect the website.
the code i m using is

var currentTime = new Date()
var month =currentTime.getMonth()
var day =  currentTime.getDate()-1
var year = currentTime.getFullYear()

plz tell em what to do
thanks in advance.

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by jwenting
0

JavaScript != Java Find a JavaScript forum.

But, if the page is generated, rather than static, than have that page include a hidden field containg the date at the time of the request.

0

Dear Masijade
thanks for ur reply.
bro what could be the code that i need to put in the java script page that i will call??
will it b calling java.util.date();

0

no, you can NOT mix Java and Javascript and expect it to work.
Instead you will have to validate the values returned from the page on the server when you get them in your servlets.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.