RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1841 | 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 9: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,536
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 141
masijade's Avatar
masijade masijade is offline Offline
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: 19
Solved Threads: 200
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.

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

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:42 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC