Jump to content

Recommended Posts

Posted

Does anyone know of a website/tool that will let me type in the name of a city, or maybe click on a map, and get the PHP-compatible timezone name for that location?

So for example if I typed or clicked on the location Christchurch, New Zealand I would get "Pacific/Auckland".

It doesn't need to be an API or anything - I just need some way to manually look up timezones for different locations.

Posted

I'm yet to find the perfect solution but so far I have found...

Search by location name (somewhat clunky and slow): https://www.geonames.org/

Click on map (can't search by name): https://askgeo.com/

Enter latitude and longitude (can't search by name): https://timezonedb.com/

For my needs I prefer a web interface but if I wanted or could be bothered with an API I found several listed in this StackOverflow answer

Posted
9 minutes ago, 3fingers said:

To me it looks like https://www.timeanddate.com/time/map/ is doing what you're after.

Thanks, but I already looked at this one and it doesn't give the timezone in the PHP name format I linked to in my post. It gives a timezone like "PST" when I need "America/Los_Angeles".

  • Sad 1
Posted

There's a really useful page https://stackoverflow.com/tags/timezone/info - though it'll make you realise you're opening something of a can of worms! 

I think, but I'm definitely not sure, that PHP uses the IANA/Olson Time Zone Database (linked on the above page). However, even if it does, I don't know how up to date PHPs list of time zones is.

The Geolite2 database from MaxMind, at https://dev.maxmind.com/geoip/geoip2/geolite2/, is free and gives IANA time zone codes. This is another option: https://www.ip2location.com/free/olson-timezone. And there may well be quite a few other such sources out there.

I don't know of any ready-made tool, but that doesn't mean there isn't one!

  • Like 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...