GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Current time by latitude & longitude  XML
Forum Index -> General
Author Message
riab



Joined: 23/01/2009 05:40:42
Messages: 3
Offline

Hi

http://ws.geonames.org/timezone?lat=49.28&lng=-122.91 returns the current time of a point.

In the timezone file, there is no way to calculate the current time

Am I missing something here? Please help.

Also, what is rawOffset & how to calculate it from the timezone file if possible?
terryh



Joined: 14/01/2009 13:54:55
Messages: 17
Offline

As far as I can tell everything you need to calculate local times for your users is there.

Get your servers time by javascript, php or whatever. Convert to say GMT. So if your server were in Barbados, using the data in 'time_zones', you would take 4 hours off.
Now if your user was in Antarctica/Davis you add 7 hours on as specified in gmt_offset.

That's one way to do it.
riab



Joined: 23/01/2009 05:40:42
Messages: 3
Offline

Thanks for your reply terryh

What about the date the DST starts & ends? for example in north america the Daylight Saving Time are to be turned forward by one hour on the second Sunday in March and turned back on the first Sunday of November.
How do I know these dates for each country or city in the world?
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

The daylight saving time rules are rather complex and not topic of the GeoNames project. Most applications and programming environments use the "tz database":
http://www.twinsun.com/tz/tz-link.htm
In java for instance this information is already included in the standard edition, try to find how to access the tz database from your favourite programming environment.

Marc

[WWW]
riab



Joined: 23/01/2009 05:40:42
Messages: 3
Offline

Thanks marc, i totaly forgot about the TimeZone class in java it has all what I need to get the correct time for the timezone
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team