Skip to content

Instantly share code, notes, and snippets.

@DTailor
Created October 25, 2012 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DTailor/3955355 to your computer and use it in GitHub Desktop.
Save DTailor/3955355 to your computer and use it in GitHub Desktop.
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