Lookup TimeZone & Weather

I am looking for a way to lookup weather and timezone based on a users location.  Basically want to pull their location from a DB and then display the local time and current weather.

What would be great is an RSS feed of some type.

I have looked for a lookup table but have been unable to find anything that helps.

If anyone knows of any free or low cost ways to do this I would appreciate the help.

Thank you,

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Use Javascript on the client side to get their timezone:

<script type="text/javascript" language="javascript">
      var tz=( new Date().gettimezoneOffset()/60)*(-1);
   // -->

Also on RSS weather feeds try:



...and above all else:

Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

mcannonmcannonAuthor Commented:
Can't pull it from the user side as we will display results of other users and it is for them we want to show the time zone and weather.  So basically you can see what the weather is and what time it is locally for a set of people.

I imagine I am looking for a DB that contains city, state/province, country along with latitude and longitute, and current UTC time.  Have not been able to find anything that remotely looks to provide this.

Just seems there has to be someplace to find the current time and weather anywhere in the world given a set of coordinates.

Firstly, nobody is going to give you free public access to a database holding this information.  The only access to this sort of data will be some sort of web page or feed that accesses the database on your behalf and returns the weather information you need.

You said an RSS feed would be ideal.  The Yahoo developer site I pointed you to explains how to send a request, along with a location and retrieve the current weather for that location.  At the moment the system is focussed on the US, but I believe they intend to provide this service for the entire (Yahoo) world pretty soon.  There are some non-US Yahoo sites that use this already.

You can also get worldwide RSS Feeds from www.weather.com, for example:

LONDON:     http://rss.weather.com/weather/rss/local/UKXX0085?cm_ven=LWO&cm_cat=rss&par=LWO_rss
NEW YORK: http://rss.weather.com/weather/rss/local/USNY0996?cm_ven=LWO&cm_cat=rss&par=LWO_rss
GENEVA:     http://rss.weather.com/weather/rss/local/SZXX0013?cm_ven=LWO&cm_cat=rss&par=LWO_rss
BOMBAY:    http://rss.weather.com/weather/rss/local/INXX0026?cm_ven=LWO&cm_cat=rss&par=LWO_rss

What you will need to do is work out what RSS feed to ask for based on the global co-ordinates you are provided with by your users.


I've been looking into this a little further.  There is no online service where you can get the city, state/province, country along with latitude and longitute, and current UTC time.  There are programs you can buy that will provide you with a manual lookup based on the city name in most parts of the world, but none of these give you what you need in a way that can deliver information to your web page or code.

However, there are resources people have put together and certain programmatical methods you can use to build the information you need.  For example, take a look at the Chronos class on phpclasses.org:


There is a file provided with that package that has locations mapped to timezones in the form:


Here is a couple of examples lifted from the file:
   Pacific/Gambier en UTC-9 NONE 258 PF PYF French Polynesia -23.133333333333 -134.95 -2308 -13457
   Europe/Berlin de UTC+1 NONE 276 DE DEU Germany 52.5 13.366666666667 +5230 +01322

Part of the information in this file originates from the timezone file configured on a Solaris unix server, but with some additional data.

You have enough information in that file to write some code to work out the timezone for any given latitude/longitude, and a reasonable spread of cities, well enough to give a reasonable weather forecast.

If you want to be more accurate, you could build a larger list of cities along with their Lat/Lon values, and use those values to find the timezone in the previous file, but I am not sure what you will achieve with that.

Your job then, will be to build your own database of possible calls to weather.com rss feeds for all cities you are able to reasonably maintain based on the granularity of your site.

Another class worth a look is http://www.phpclasses.org/browse/package/693.html which draws a map with the Lat/Lon pinpointed - might be useful for you.

BTW - I'm expecting an A grade on this, I spent more than 45 minutes working out how you can do this, and the solution is entirely operable.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.