views:

271

answers:

3

Hi,

Can you recommend any implementation of Time Zones support for Django's ORM (DateTime filed)?

Ideally it has to be DB-agnostic and transparent, allowing to use all standard ORM things like __lt, __gt etc.

I guess it needs to store time in UTC plus local timezone.

Thanks!

+1  A: 

You might want to look at the django-timezones app. It was posted in response to ticket #8953 on the django bug tracker. The ticket also talks about a bulbs application that the Onion uses on their site to handle timestamps.

Soviut
Unfortunately, "**Please note:** Bulbs is deprecated and no longer maintained." http://github.com/korpios/bulbs/tree/master
Art
Thought Bulbs is unmaintained it remains the same as the code used internally at the Onion for timezone support (I was an intern there over the summer).
Alex Gaynor
It does not seem to be DB-agnostic either...
Art
+1  A: 

I'm not aware of a pre-canned implementation you can use, but this post discusses how to implement a Django date field which maps to multiple database columns.

Vinay Sajip
+1  A: 

UTCDateTime seems to satisfy most of the requirements.

Art