...

View Full Version : World Clock



tomyknoker
07-26-2007, 08:37 AM
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?

matak
07-26-2007, 08:43 AM
... 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.. :D (sorry for OT, i couldn't help it)

StupidRalph
07-26-2007, 09:16 AM
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

tomyknoker
07-26-2007, 09:57 AM
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! ;)

_Aerospace_Eng_
07-26-2007, 10:08 AM
I wonder if you could sync up with live.windows.com?

StupidRalph
07-26-2007, 10:33 AM
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 (http://www.actionscript.org/forums/showthread.php3?t=32918)). 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

tomyknoker
07-26-2007, 11:49 AM
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.




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

mlseim
07-26-2007, 03:30 PM
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?

timgolding
07-26-2007, 03:35 PM
php has some quite good functions for dealing with timezones. You therefore could use this instead of the xml method .
timzone_offset_get (http://uk.php.net/manual/en/function.timezone-offset-get.php)
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum