User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 426,194 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,831 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1748 | Replies: 3
Reply
Join Date: Mar 2007
Location: India
Posts: 28
Reputation: bhuvan83 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
bhuvan83's Avatar
bhuvan83 bhuvan83 is offline Offline
Light Poster

Help how to get servers date

  #1  
Mar 30th, 2007
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.
Last edited by bhuvan83 : Mar 30th, 2007 at 8:22 am.
Bhuvan Aggarwal
There is no word impossible.
its i m possible
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,460
Reputation: masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice masijade is just really nice 
Rep Power: 9
Solved Threads: 131
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: how to get servers date

  #2  
Mar 30th, 2007
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.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Mar 2007
Location: India
Posts: 28
Reputation: bhuvan83 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
bhuvan83's Avatar
bhuvan83 bhuvan83 is offline Offline
Light Poster

Re: how to get servers date

  #3  
Apr 2nd, 2007
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();
Bhuvan Aggarwal
There is no word impossible.
its i m possible
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: how to get servers date

  #4  
Apr 2nd, 2007
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.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 6:57 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC