</script> </body> this is working fine.now the problem is,the date which i am getting is my system date.if i change the date of my system,then that changed date is comming.i want the actual date to be displayed irrespective of the system date because the date plays a crucial role in my application. pls can anybody help me to solve this problem. Jyothsna
If you want to become a rich, do not work for others but make others to work for you.
Joined: Jul 21, 2003
Thanks for your response. Can you please help me further by giving some code. Jyothsna
Joined: Feb 03, 2003
Joined: Jul 21, 2003
let me put the question in the other way.Say i have server and client both running on the same system and the date of that system is wrong.In that case my server also takes the system date which is wrong.So how to get the actual date. Thanks in advance, Jyothsna
You need to do it on the server side, it was said before that that is the only way to do it safely. Why would the date be wrong on the server if that is the case then I think you should fix the time? It may be in another time zone, and you might need to take in account for that? The only true way to do it is if you are standing there and making sure that the date is right. What says that your watch is also set wrong? Eric [ March 03, 2004: Message edited by: Eric Pascarello ]
It's a bit hard to tell what would be "wrong" about the system time - maybe you're trying to avoid working with the local time? Maybe using Universal Coordinated Time (UTC) would help? You can get that from your date object with a bunch of methods like getUTCMonth etc. They're listed at http://www.w3schools.com/js/js_datetime.asp where you can play with them directly, that's pretty fun.
You wouldn't necessarily have to go through the date and pick out the individual parts - there's a toGMTString() method that gives you the Greenwich Mean Time. (For most practical purposes that's the same as UTC.)
and that will get you the Greenwich Mean Time in this form: Wed, 03 Mar 2004 14:57:59 GMT
If you want to ensure that your server time is accurate, you should investigate setting up an NTP server (Network Time Protocol). This service would sync with 'known accurate' NTP servers elsewhere. Much like Certification authorities... at the very top are universities and US Navy atomic clocks. Eventually it gets down to a 2nd or 3rd tier provider that can keep your NTP server at 'the correct time'. Then use this server to keep all your other servers on your network on 'the correct time'.