Thank you...

The best feature in web2py is its community...



On Saturday, November 24, 2012 5:01:32 PM UTC+3, dederocks wrote:
>
> Hi, 
>
> I've used the following query successfuly:
>                     query = 
> (db.mesures.date.epoch()-db.lots.date_fabrication.epoch()) >= 
> (critere.valeur_inf*86400)
> And then db(query).select(...)
>
> mesures.date and lots.date_fabrication are datetime fields.
>
> Hope this helps!
>
> Le jeudi 22 novembre 2012 21:55:04 UTC+1, dederocks a écrit :
>>
>> Hi, 
>>
>> If you have two datetime fields dta and dtb, a db().select(dta-dtb) will 
>> return zero using the sqlite db, but a correct value if you use postgresql 
>> for example.
>> The trick to make it work is to replace dta by julianday(dta) in the 
>> select, e.g. db().select(julianday(dta)-julianday(dtb)).
>>
>> I guess not that easy to fix, especially since this substitution would 
>> have to operate only when a datetime delta is computed?
>>
>> Or is there a way to do it I havent't found?
>>
>> Andre
>>
>

-- 



Reply via email to