Skip to content

So you never again have to say “It’s 5 o’clock somewhere…”

Notifications You must be signed in to change notification settings

segdeha/whereisitfiveoclock.beer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

So you never again have to say “It’s 5 o’clock somewhere…”

If you dig it, consider tossing some 🍺💰 my way: venmo.com/segdeha

colophon

It was weirdly hard to answer the question, “where is it currently 5 o’clock?” I ended up cobbling together a solution using a couple of different data sources and a bit of scripting.

I start by calling the GET /list-time-zone endpoint on TimeZoneDB.com to get the current time in each time zone around the world.

I then loop through the results and pull out each time zone (America/Los_Angeles, Europe/Andorra, Antarctica/McMurdo, etc.) where the current hour is 17 (i.e. 5pm).

Next, I query a simple database consisting of 2 tables, one containing 24,297 cities with their associated time zones, the other that’s used to look up country names from country codes, the data for both coming from geonames.org.

Finally, I cache the JSON response I send back to the browser so it’s regenerated at most once every half hour.

Super simple, but it works! ¯\_(ツ)_/¯

The spinning globe was, um…borrowed from a blog post by Bjørn Sandvik.

About

So you never again have to say “It’s 5 o’clock somewhere…”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published