[Zope] Re: Whats the Format of Date in portal_catalog( )??

Dieter Maurer dieter at handshake.de
Wed Aug 13 21:51:04 EDT 2003


Josef Meile wrote at 2003-8-13 17:17 +0200:
 > >      I want to get the news items by date. for eg...news items 
 > > created on a particular date.
 > > 
 > >    I tried with container.portal_catalog(created='2003-08-13'),
 > >               container.portal_catalog(created='2003/08/13') and 
 > > many other....
 > > 
 > > But i am not getting anything in result...though i have some 
 > > data...
 > > 
 > > Is there any problem with date format...??? if yes please specify 
 > > me the correct format??
 > I think that you have to pass a DateTime object and not a string:
 > from DateTime import DateTime
 > container.portal_catalog(created=DateTime('2003/08/13'))

Also remember that it is very unlikely that a document is
created at 'some_date 00:00:00' (this is what you effectively get from
"DateTime(some_date)"). You will need a range query
to effectively search for dates.

Please read the appropriate section in the Zope Book (2.6 edition).


Dieter



More information about the Zope mailing list