Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Time synced to time server - not user's pc time

Status
Not open for further replies.

dotobi

Technical User
Mar 9, 2004
229
HK
Hi

How do you add the date and time to a page, but having it sync to a time server rather than the user's pc.

I used a Macromedia Extention for Dreamweaver from Koasweaver.com called Live Clock, but this just mirrors the user's PC time.

thanks
 
Have a small form with one input as text and two hidden inputs coming from the server. One hidden element is set to the date from the server the other one to the time. As soon as you get them create a date object in Javascript based on the hidden values and assign the result to the textbox. Have a timer that refreshes the now sync date/time box every second.
That should do it.
I would throw some lines of code but right now I'm in the middle of something. Let me know how it goes. Probably today after work I can write the code.



grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
If you're looking to have a running clock on the page, then grtfercho's solution will work.

However, if you're just looking to stamp the time/date on the page with the current time/date on the server, then there are functions that will do that for you based on the language you are utilizing (if not html).

For example, php has the functions time() and date() that return the server's time and date, not the client's.



*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top