On 17 August 2010 05:24, Russell Keith-Magee <russ...@keith-magee.com> wrote: > On Tue, Aug 17, 2010 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com> wrote: >> I been doing a lot with timezone aware dates and I noticed that the mysql >> store will not allow you to store a datetime aware datetime. > > Adding timezone sensitivity to Django's time/datetime fields is > something that has been on the project to-do list for almost as long > as I've been associated with the project (coming up on 5 years). If > you're interested in tackling this problem, here's a couple of things > to keep in mind: > > * Backwards compatibility. Suddenly introducing a 'convert to local > timezone' behavior (or similar) will break any existing install. > * The interaction between application timezone and database server timezone. > * MySQL. Postgres supports timezones in date fields. MySQL doesn't. > We need to have a solid answer for how this feature will work on > databases that don't support timezone handling.
As I see it there's two possible usage scenarios of date(time)s. 1. Those who don't need to care about timezones at all, for instance because no dates are ever shown or shared, or all data will be from a single timezone that doesn't utilise daylight savings time, or accuracy better than two hours each way is not needed. This is unfortunately what Python's datetime-module were designed for. 2. Everybody else. 1 is already solved today. There's more than one way to solve 2. a) Convert to a single timezone on save (typically UTC but need not be), and convert to a local timezone when showing. The question then is whether it is relevant to save the timezone of the original datetime. This might leak the location of where the input originated. I currently store everything as UTC and throw away timezone info. b) Store timezone directly, convert to local timezone when showing. Then your dates are only as good as your locale-database since daylight savings start/end tends to be changed by whoever has political power at the moment. c) <insert own bikeshed-blueprints here> HM -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.