I\'m saving datetime
in the db for an object. I\'d like to query against the db and select anything from todays date
, not datetime.
What\'s the
in django<1.9
from django.utils.timezone import datetime #important if using timezones
today = datetime.today()
foo_for_today = Foo.objects.filter(datefield__year=today.year, datefield__month=today.month, datefield__day=today.day)
in django>1.9, as they added the date keyword
foo_for_today = Foo.objects.filter(datefield__date=datetime.date.today())