2

My script has as input the latitude and longitude values as GPS coordinates.

How can I get the current local time?

Are out there solutions that do not use databases or web services?

PHP has a method to retrieve location based on a timezone, I am wondering if the reverse exists or not

Pentium10
  • 190,605
  • 114
  • 394
  • 474
  • possible duplicate of [Timezone lookup from latitude longitude](http://stackoverflow.com/questions/41504/timezone-lookup-from-latitude-longitude) – John Conde Jun 24 '10 at 17:15
  • That dup is 2 years old, I hope PHP 5.3 has some inbuilt method for this one. – Pentium10 Jun 24 '10 at 17:45

2 Answers2

2

geonames.org provide a range of webservices that can be used to get details from latitude and longitude. For example http://ws.geonames.org/timezone?lat=47.01&lng=10.2&style=full

You can just fetch that with your PHP code and parse the result.

See http://www.geonames.org/export/ws-overview.html for details of the available webservices.

John Lawrence
  • 2,813
  • 14
  • 23
1

Use this datafile. The data you are looking for is in zone.tab. wikipedia also has an overview of it - the table is generated from the datafiles.

Femaref
  • 58,195
  • 7
  • 126
  • 170