[Django]-Django set DateField from a DateTimeField

3👍

Use datetime.datetime.date() to get the date component like so:

a = A()
b = B()

# Stuff

b.x = a.x.date()

See http://docs.python.org/library/datetime.html#datetime-objects for more details.

Leave a comment