Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django ORM: time zone support

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!

like image 948
Art Avatar asked Mar 24 '26 02:03

Art


2 Answers

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.

like image 189
Soviut Avatar answered Mar 26 '26 15:03

Soviut


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.

like image 39
Vinay Sajip Avatar answered Mar 26 '26 15:03

Vinay Sajip



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!