Hi Hyunseo Yang, SQLite does not save the timezone in the database. If you pass it a datetime with timezone encoding then it calculates the UTC time that that time represents and stores that.
It is explained here: https://www.sqlite.org/lang_datefunc.html As far as I understand whatever database you are using, Django always stores datetimes as UTC. What version of Django are you using as timezone awareness is different for different versions. Dan On 2 June 2015 at 07:23, Hyunseo Yang <hsinh...@gmail.com> wrote: > > I'm using Sqlite for my project database. > I need date and time in my model so i'm using this field. > > date = models.DateTimeField() > > > On the result template (results.html), the time is correct (localtime > or TIME_ZONE in my settings.py) > The problem is, when i check the database on Django admin page and sqlite > db file, it seems like my timezone setting is not applied.(so, maybe UTC) > > what is the problem and how could i fix this? > > I think the template's parameters are from view, so the timezone.now() is > correct and passes the right time. > So my guess is that 'date=timezone.now()' passes to sqlite like this: > 'insert into table values (date=datetime('now'))' > and the timezone of sqlite is maybe set to UTC default. > this is what i'm guessing. am i right? also i do not know how to set > sqlite database timezone... > > p.s On the other side, I also think when we set settings.py TIME_ZONE, > django would manage all these things. > So don't know where to approach. Spending almost 2 days on this problem... > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/6269c301-d704-4294-863d-bb6c65d7140f%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/6269c301-d704-4294-863d-bb6c65d7140f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Wildman and Herring Limited, Registered Office: 52 Great Eastern Street, London, EC2A 3EP, Company no: 05766374 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPZHCY6C9D1DD2EPLmtQmJxd7irDgjqr8kytm1%2By-Sg0cPZ%2B1Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.