Created
October 25, 2012 20:58
-
-
Save DTailor/3955355 to your computer and use it in GitHub Desktop.
Get all objects added today from midnight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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