[Zope-DB] Question on ZSQL and Dates

Charlie Reiman creiman@kefta.com
Wed, 23 Oct 2002 10:36:37 -0700


> -----Original Message-----
> From: zope-db-admin@zope.org [mailto:zope-db-admin@zope.org]On Behalf Of
> Charlie Clark
> Sent: Wednesday, October 23, 2002 12:24 PM
> To: zope-db@zope.org
> Subject: RE: [Zope-DB] Question on ZSQL and Dates
>
>
>
> On 2002-10-23 at 16:16:32 [+0000], you wrote:
> > In my experience, it's best to leave date handling up to
> database whenever
> > possible.
> >
> > select * from person where
> > (sysdate - person.birthdate) > (45*365.25);
> >
> > Hopefully someone will have a better solution for you.
> sysdate doesn't seem to be available. I assume this is some DB-specific
> variable?

Yep. sysdate is oracle's way of asking what time it is. Check your vendor
docs. There is probably something similar.

> You seem to be implying that the DateTime object's basic unit is
> days but I
> think it's seconds. It might even be milliseconds... This would explain
> some of the results I'm getting by trial and error.

No, I'm not implying anything of the kind. I never used DateTime above.
Oracle's date artimatic is based on days.

FWIW, I think DateTime is also day based, at least when it comes to addition
and subtraction. Internally, it probably uses seconds or millis but adding
and subtracting integers is supposed to result in day deltas. I'm not sure
what DT +/- DT gives.

>
> I've read somewhere that installing mxDateTime makes life a lot
> easier and
> I can believe it but I haven't yet worked out how to get Zope to use
> mxDateTime instead of DateTime. Stephan Richter's modules don't work on
> Zope 2.5.1

Well, like I said, I hope someone else can help you out.