Try this:

from datetime import date

today = date.today()

todays_stuff = Stuff.objects.filter(created_on = today)



On Oct 12, 10:07 pm, aa56280 <aa56...@gmail.com> wrote:
> I have a DateTimeField called "created_on" on a model called
> "Documents". It serves as a timestamp for when the record was added.
>
> I'm trying to write a query that will return all Documents created_on
> a particular date, say today. I can make it work if I look for a
> record within a range of dates...
>
> <code>
> today = datetime.datetime.today()
> thirty_days_ago = today - datetime.timedelta(days=30)
> Document.objects.filter(created_on__range=(thirty_days_ago, today))
> </code>
>
> But now, I need to find records that were created on a particular
> date, like, today.
>
> How do I do that?
>
> Any thoughts greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to