Yes I do not know how to compare dates with datetime fields in a query. I suppose there would ideally be some built-in method to express one type as the other. Maybe someone knows a way to do it... D
On Feb 15, 7:20 am, Manuele Pesenti <manuele.pese...@gmail.com> wrote: > Il 14/02/2011 19:57, villas ha scritto: > > > Well, this might not help at all... but maybe you can pick out > > something to give you a step forward:) > > I cannot see how, the problem is the introduction of a function inside > an expression in which appears fields objects that contains date or > datetime objects and not directly theese ones. > > At the moment I resolved introducing a virtual fields that calculates > the difference between the two date and filtering the results AFTER the > query... but I don't know if it is an optimized solution. > > thanks > Manuele > > > import datetime, time > > # create a datetime for the example > > d1 = datetime.datetime.today() > > # convert the datetime to date > > d2 = datetime.date(*time.strptime(d1.strftime("%Y-%m-%d"), "%Y-%m-%d") > > [0:3]) > > # here's the proof > > print type(d1), type(d2) > > > Ugly as hell!:-) > > -D > >