Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript to show time based on a particular time zone

    would there be any way for me to use javascript to display the time based on the time of a particular time zone, rather than the time on the user's computer?

    thanks

  • #2
    New Coder
    Join Date
    Apr 2007
    Location
    Silicon Valley California
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is, but it requires some server-side scripting. You need to pass the server time (which is a known timezone) to the script, then you can compare the user's time against the server time. To know what timezone the user is in. With those two points of data, you can determine the relative time in any timezone.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    It can be done with JavaScript.

    Digital clock - http://javascript.about.com/library/bldtime1.htm
    Analog clock - http://javascript.about.com/library/blclock1.htm
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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