Results 1 to 7 of 7

Thread: International Time Script

  1. #1
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default International Time Script

    I have noticed a few scripts on the page that display clocks on the web page. Any way you can change the script to display the time in, for example, London?

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, I could modify a script for you. It would take the user's system time and modify it by +x or -x hours.
    Pick any clock script, with a llink to it here if this is what you mean.

    cr3ative
    Last edited by cr3ative; 10-24-2004 at 05:21 PM.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Oct 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Sounds good

    http://www.dynamicdrive.com/dynamicindex6/clock3.htm

    Just tell me where to edit.


    Also, will it make a different if people are accessing it on different coasts of the U.S.? (can you just add a simple +8 for London?)

  4. #4
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    var hours=mydate.getHours()+1

    Would add one hour to this script.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  5. #5
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    It's actually a little more complicated than that, unfortunately. Since you have no idea what time zone the user is in, you'll need to use either the Date.getTimezoneOffset() function or some other fixed time function to eventually determine the current time that doesn't change regardless of what the user's timezone is. Unfortunately due to time constraints I can't make the modications for you, though try searching on Google for such an example...

  6. #6
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well yes, ideally it would get the time from a world time server, but they all seem to have no support for projects like this.

    I forgot to mention that it relies entirely on the system clock

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  7. #7
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Quote Originally Posted by cr3ative
    Well yes, ideally it would get the time from a world time server, but they all seem to have no support for projects like this.

    I forgot to mention that it relies entirely on the system clock

    cr3ative
    Yep, if your page is PHP for example, you can use PHP to write out a variable in JavaScript containing the system clock, then simply increment that by x hours depending on the World time you want to display.

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
  •