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

Thread: World Clock

  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts

    World Clock

    hi all... i want to try and build a world clock, not even sure if i'm in the right forum... i'm assuming i would need to hook into an api or web service to do this yes? does anyone know of any?

  • #2
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by tomyknoker View Post
    ... not even sure if i'm in the right forum...
    unless you are building an atomic clock, or a new big ben, i would guess you'r in the right forum.. (sorry for OT, i couldn't help it)

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    What are you planning to do with your clock? I think one important thing is that you have to consider is that not all timezones are even. Some places in Canada (Newfoundland) have a half hour difference they're (GMT -3:30) and places in Iran (Tehran) is something like (GMT 5:30) so you'll have to figure out the best way to handle these places or as you stated if there is a web service to do this for you will be cool
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Yea well I want the person to be able to select their country, then from ther select their city... And wala! Is this StupidRalph from actionscript.org? I PM'ed you some scrolling text code I got from Lee... Oops cross forum posting!

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I wonder if you could sync up with live.windows.com?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Quote Originally Posted by tomyknoker View Post
    Yea well I want the person to be able to select their country, then from ther select their city... And wala! Is this StupidRalph from actionscript.org? I PM'ed you some scrolling text code I got from Lee... Oops cross forum posting!
    [OFF TOPIC]LoL yes this is the same StupidRalph...thats funny. I actually PMed you that code later that same night (here's the link). Thats actually the how I found out about actionscript.org. I finally figured out what I was doing wrong and uploaded a .fla. I'll check your post over there. [/OFF TOPIC]

    Check out this site... http://www.worldtimeserver.com/ I think they have a XML file with DST
    Last edited by StupidRalph; 07-26-2007 at 10:39 AM.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #7
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I had a look at world time server, great site but you have to pay... SO I've decided I'll build my own, question for anyone who might know. So using their example I'll create the file in an xml document e.g.


    Code:
     
    <?xml version="1.0" encoding="iso-8859-1" ?> 
    <tz_data>
    <Location>
    <LocationID>AU-WA</LocationID> 
    <Country>Australia</Country> 
    <Region>Western Australia</Region> 
    <Landmarks>
    <City>Perth</City> 
    </Landmarks>
    <StdBias>+0800</StdBias> 
    <DstBias /> 
    <DstStart /> 
    <DstEnd /> 
    </Location>
    </tz_data>
    

    That part is easy, time consuming but pretty straight forward I think...BUT my query is say I build the page in PHP or Flash or whatever, and have this in a database... I'll always need to use somekind of timeserver from somewhere? So the computer can work out the time by the country/city selected? Or would I use the users time on the computer as the base?

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    You'll have to pick an accurate time from somewhere and then do all of
    the timezone / daylight savings time conversions.

    Here's an accurate clock, you could read the page with PHP and search
    for the time within the HTML. It would be a snapshot, not an actual
    running time, but it is accurate ... short of the time to load and display.

    http://www.time.gov/timezone.cgi?

  • #9
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    php has some quite good functions for dealing with timezones. You therefore could use this instead of the xml method .
    timzone_offset_get
    allows you to calculate the difference in seconds between any timezone and GMT. I presume you can then add this to a timestamp to calculate the real date.

    Heres a full list of functions that can help you

    http://uk.php.net/manual/en/ref.datetime.php
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

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