English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want the date to be displayed in my webpage and it's should be get updated automatically based on the server time. I have know whether it can be done in JavaScript?

2007-04-02 01:43:09 · 4 answers · asked by MADDY 3 in Computers & Internet Programming & Design

4 answers

http://www.javascriptkit.com/script/script2/servertime.shtml

outlines how to do it with javascript and no special server side programs (except Apache SSI) and shows a method for php also!

2007-04-02 09:52:19 · answer #1 · answered by jake cigar™ is retired 7 · 2 0

As was mentioned, you need to have something on the server to provide it's time.

If you are interested in updating the time on a page via Javascript but want the time itself to be from the server you could consider using an Ajax call to a page on the server that returns the time.

2007-04-02 03:04:36 · answer #2 · answered by Interspike 1 · 0 1

JavaScript runs on the client machine, so no you cannot display the server time using Javascript. What you need is an SSI(Server Side Include) or another server side program like Perl, CGI, ASP or PHP.

2007-04-02 01:48:55 · answer #3 · answered by AnalProgrammer 7 · 1 2

Sure, go here http://www.javascriptkit.com/script/cutindex1.shtml and there are a number of scripts for you to use to do what you want.

Also, here's a snippet of code for you to try:











2007-04-02 01:48:30 · answer #4 · answered by John S Wiggins 4 · 1 2

fedest.com, questions and answers