Simon Willison’s Weblog

6 items tagged “timezones”

Building a location to time zone API with SpatiaLite, OpenStreetMap and Datasette

Given a latitude and longitude, how can we tell what time zone that point lies within? Here’s how I built a simple JSON API to answer that question, using a combination of data from OpenStreetMap, the SpatiaLite extension for SQLite and my Datasette API tool.

[... 2152 words]

django-timezones. Models, form fields and a template filter for dealing with timezones in Django. # 21st August 2008, 11:18 pm

What’s New in Edge Rails: Easier Timezones (via) Time zones can be a nightmare to get right—if this works well it’s going to make a lot of people’s lives a whole bunch easier. # 2nd April 2008, 3:39 pm

calendar.timegm() (via) An “unrelated but handy function” that converts a time.gmtime() in to a corresponding Unix timestamp. I’ve been hand-rolling this one for years; never thought to look in calendar. # 3rd September 2007, 1:54 am

Django vs feedparser on dates. Some useful tips in the comments. I find Python’s timezone stuff endlessly frustrating: I know it can do what I want, but it always takes me a ridiculously long time to figure out the necessary incantations. # 2nd September 2007, 10:17 am

A Zoned Defense. Using JavaScript’s date.getTimezoneOffset() to detect the user’s timezone and stash it in a cookie. # 20th March 2007, 9:51 am