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.

Recommended Answers

All 3 Replies

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.

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();

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.