Thank you so much -- saved quite a bit of work!
With much appreciation, 
Andre

Le jeudi 22 novembre 2012 23:54:31 UTC+1, Niphlod a écrit :
>
> Mind that the functionality is database dependant, hence you won't get the 
> same results changing the db engine. Moreover you get different "rounding" 
> errors trying to subtract similar dates.
>
> Recent web2py's DAL supports an "epoch()" method that returns "seconds 
> passed since 1-1-1970". If you can live with that, it's more deterministic 
> and safer and works in the same way in all engines (e.g., need to develop 
> on sqlite and in production use postgresql) and its functionality is 
> supported on practically every db.
>
> On Thursday, November 22, 2012 9:55:04 PM UTC+1, dederocks wrote:
>>
>> 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