Simon Willison’s Weblog

5 items tagged “datetime”


Tips on using python’s datetime module. Wow. I’ve run in to problems with datetime and timezones before, but I had no idea how intrinsic those problems were to the design of the library. # 6th July 2009, 2:20 pm

Making the HTML5 time element safe for historians. PPK presents a detailed history of dates and calendars and points out that the HTML5 time element is ill prepared to faithfully represent the kind of dates historians are interested in. # 6th April 2009, 2:01 pm


Datejs—A JavaScript Date Library. Building a date API around chaining——is a neat concept. I’d like to see that adapted for Python’s datetime library. # 3rd December 2007, 9:01 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