View Full Version : Local Time script not displaying time at all

01-26-2010, 01:03 AM
1) Script Title: Local Time script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/localtime.htm

3) Describe problem:

I've tried this script on a page, but I get the following:

Current Server Time:NaN:NaN:NaN AM (undefined)

What am I doing wrong? Should I be changing something within the script to make it work?

I'm new round here by way :), and only just started learning html and css, so don't really understand how js works... :rolleyes:

Many thanks in advance for any help you can offer!

01-26-2010, 01:22 AM
You have to get the time from the server using PHP (ie: .php), ASP, or SSI (ie: .shtml). Which one of those do you have/ want to use?

01-26-2010, 02:13 AM
Hie bluewalrus, thanks for your reply, I'd go for php as I understand it a little bit better than the others... the page is already saved as .php, what am I doing wrong? :confused:

01-26-2010, 02:20 AM
You would have to post a link to your page or the code you are using for us to see. If the problem is in PHP, then we cannot view the code in view>source, so that will need to be posted as code here.

01-26-2010, 02:25 AM
Duh. Just realised what the mistake was. I copied the code straight from the page:

Current Server Time:<span id="timecontainer"></span>

<script type="text/javascript">
new showLocalTime("timecontainer", "server-ssi", 0, "short")

Didn't realise I had to change "server-ssi" to "server-php". Just spotted that so thought I'd try and it's now working. Hurrah! I told you I was a newbie.... :rolleyes:

Sorry to have wasted your time, but hopefully this will help another newbie that may stumble upon this! :)

01-26-2010, 02:28 AM
Daniel - off topic, but thought you may want to change your signature... it's "estudio espaņol", no "estudiaba", this is past tense, unless of course that's what you meant! :)

01-26-2010, 02:46 AM
Yes, I studied it a while ago, and I've forgotten many of the details (I can understand it, but when I speak it comes out in Italian, or now Portuguese).

Glad the script is now working.