[Zope] searching a date
Dieter Maurer
dieter@handshake.de
Sat, 3 Nov 2001 21:17:53 +0100
Steffen Hausmann writes:
> i need to find a date stored in a ZCataolg.
> the problem is that the date has a time in it ( '2000/01/01 12:00:00
> GMT+1' ) that i dont know.
>
> i tried to turn the index type of the date to textindex, but that didn't
> work because only letters are stored in it ( 'GMT' ).
> if this would work i could just search for the date because it gets
> seperated by blanks when it is put into the catalog ( '2000/01/01',
> '12:00:00', 'GMT+1' ).
You need a "range" query to successfully search dates.
Look in the Zope book or
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
for details.
As you are in the european timezone, you may be hit by a
bug in Zope's DateTime module:
DateTime('yyyy/mm/dd') != DateTime(yyyy,mm,dd)
because one respects the time zone, the other does not.
Dieter