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 2 of 2

Thread: Clocks in PHP

  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clocks in PHP

    I'd like to figure out how I can make a clock on my webpage, that shows an analog clock. Could be javascript. But I'd like to have a drop down or radio button menu of time-zone selections. So that the person viewing the site can select their timezone. But I also want it to save that timezone the next time that person goes to the website again. So if you wanted a Japanese timezone, you select it. Next time you go back to the site, it still reads the Japanese timezone.

    Any help will be appreciated!

    -Lucky

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,107
    Thanks
    2
    Thanked 326 Times in 318 Posts
    The only way to have a smooth dynamic analog real time clock on a web page is to use javascript to display it. Here is a link that contains some sample scripts - http://www.dynamicdrive.com/dynamicindex6/index.html

    For most of what you want, the easiest way would be to code the javascript clock script so that it used an initial starting time value that you supply instead of using the browser's local time.

    The rest of what you want is simple HTML form code.

    Store the time zone they select in a cookie to allow them to leave your site and return later.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

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