[Zope-DB] Re: Question on ZSQL and Dates

Michal Kurowski michal@genesilico.pl
Wed, 23 Oct 2002 20:33:55 +0200


Charlie Clark [charlie@begeistert.org] wrote:

> 
> Yes, I've been coming to the conclusion that it's going to be vendor 
> specific. I am currently using MySQL and have discovered the YEAR() function
> but am still having trouble getting the results I want.
> 
> I don't know if I'll be able to adopt your method though as I actually need 
> to get intersects
> ie.  40 <= (year from now() - year from birthdate) <= 45
> for Between 40 & 45
> although my docs say 40 <= YEAR(now()) YEAR(birthdate) without even 
> mentioniing now()

select name, id, birthdate, (extract(year from now()) - extract(year
from birthdate)) as delta from person having delta between 40 and 45;

Would this work ?

If you use mySQL there should a really nice piece of docs somewhere on
your disc. Info format or html.

> It would be so nice to do this in Python :-(

Not sure. I actually use "strftime" a lot but the DateTime objects
themselves require some major investigation ;-).

Cheers,

-- 
Michal Kurowski
<michal@genesilico.pl>