1👍
Python datetime from the standard python library is a mess.
Probably you are creating naive datetime instances (instances that lack timezone information).
# naive
now = datetime.datetime.now()
# TZ aware
from django.utils.timezone import utc
now = datetime.datetime.utcnow().replace(tzinfo=utc)
In recent Django, datetime storage is always offset-aware, so you better convert naive datetimes – otherwise an automatic (and sometimes wrong) conversion will take place.
Take a look at the docs about Django Time Zones.
1👍
Just a through on this. As of Django 1.4, Django now supports timezone aware dates and times. Perhaps it’s possible that a conversion between your local timezone and the timezone that the data is stored in (possibly GMT) is taking place at some point. Perhaps that difference crosses the international date line, in which case the dates may show up differently.
Django has an interesting section describing the new timezone support feature.
https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/
That’s what came to mind, anyway, when you described your problem. Hope this helps.
- [Answered ]-Django crispy form button not showing
- [Answered ]-Django Site_ID's and Sitemaps
- [Answered ]-Google App Engine + Django with multiple apps within project = ImportError
- [Answered ]-Django – Override Default Manager in Admin – InheritanceManager