dbee wrote:
> DateField and Postgresql
> 
> Thanks
> 
> On Nov 13, 6:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>> dbee wrote:
>>> I'm having a simple issue here trying to pull dates out of a database.
>>> I can only pull out double digit months eg. October, November,
>>> December but not single ...
>>> Database: entry_date
>>>   2008-10-12
>>>   2008-09-12
>>> DB API:
>>>   month_1_count = all_sign_up.filter(entry_date__month=9).filter
>>> (entry_date__year=2008).count()
>>> That doesn't match and pull out the value but this works fine ...
>>>   month_1_count = all_sign_up.filter(entry_date__month=10).filter
>>> (entry_date__year=2008).count()
>>> I'm probably missing something really simple here ...
>> How are you declaring the dates in the model, and what database platform
>> are you running on?
>>
I'd say we needed a bit more information. The following output is based
on a PostgreSQL 8.3 database:

In [1]: from info.models import Dptnwsfrontpg

In [2]: [d.crdt for d in Dptnwsfrontpg.objects.all()]
Out[2]:
[datetime.datetime(2008, 11, 14, 8, 28, 51, 492000),
 datetime.datetime(2008, 9, 14, 8, 32, 58, 912000)]

In [3]: [d.crdt for d in Dptnwsfrontpg.objects.all().filter(crdt__month=9)]
Out[3]: [datetime.datetime(2008, 9, 14, 8, 32, 58, 912000)]

In [4]: [d.crdt for d in
Dptnwsfrontpg.objects.all().filter(crdt__month=9).filter(crdt__year=2008)]
Out[4]: [datetime.datetime(2008, 9, 14, 8, 32, 58, 912000)]

[...]
In [6]:
Dptnwsfrontpg.objects.all().filter(crdt__month=9).filter(crdt__year=2008).count()

Out[6]: 1L

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to