Skip to content

Instantly share code, notes, and snippets.

@DTailor

DTailor/gist:3955355

Created Oct 25, 2012
Embed
What would you like to do?
Get all objects added today from midnight
import datetime
from django.utils.timezone.utcnow().replace(tzinfo=utc)
now = datetime.datetime.utcnow().replace(tzinfo=utc)
midnight = now.replace(hour=0,minute=0,second=0,microsecond=0)
queries = YourModel.objects.filter(time__gte = midnight )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment