how to save date and time using localtime in Django?
Question: So I am trying to learn Python and Django... Great language and framework.

That said, please excuse me for my seemingly very dumb question.

I have a Django project which won't be used outside a single timezone, so it
doesn't really make much sense to save stuff in UTC and convert to the "local"
timezone when needed.

The problem is that I can't seem to find a "Python/Django" way to do it
properly as seen below:

    
    
    > python manage.py shell
    Python 2.7.10 (default, Jul 14 2015, 19:46:27)
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>> from django.utils import timezone
    >>> timezone.localtime(timezone.now())
    datetime.datetime(2015, 10, 19, 10, 17, 58, 153065, tzinfo=<DstTzInfo     'America/Sao_Paulo' BRST-1 day, 22:00:00 DST>)
    >>> from thingie.models import Thingie
    >>>  a=Thingie(field1="teste",field2="12121",field3="112121",field4="904095034",timestamp=timezone.localtime(timezone.now()))
    >>> a.save()
    

As it stands, this creates a record in my MySQL database, but the timestamp
field is recorded as UTC time...

What am I doing wrong? How can I save the timestamp in localtime?

Thanks in advance!

**EDIT**

As per my comments to Daniel's response, using datetime generates a warning in
Django, which led me to disable USE_TZ (`USE_TZ = False`). This seemed to do
the trick, but I wonder if there are any unwanted behaviours, since the
documentation recommends to use timezone support.

Thanks again!


Answer: If you don't care about timezones, don't do anything at all; just save it.

    
    
    a = Thingie(field1="teste", field2="12121", field3="112121", field4="904095034", timestamp=datetime.datetime.now()))
    

Note, for timestamps, it's simpler to use the `auto_now` and `auto_now_add`
options in the field definition, which will set the time automatically.

