Results 1 to 7 of 7

Thread: Local Time script not displaying time at all

  1. #1
    Join Date
    Jan 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Local Time script not displaying time at all

    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...

    Many thanks in advance for any help you can offer!

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Jan 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jan 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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")
    </script>

    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....

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

  6. #6
    Join Date
    Jan 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •