[Zope-DB] Question on ZSQL and Dates

M.-A. Lemburg mal@lemburg.com
Wed, 23 Oct 2002 20:22:06 +0200

Charlie Clark wrote:
> 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
>>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?

Yes. sysdate is Oracle's way of saying "give me the current time
in your own format". Which database backend are you (currently ;-)
using ?

Also, what's the error message you get from Zope when you
try your solution ?

One possibility is that the database expects a specific date
format and that Zope's DateTime objects don't use this per

> 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.
> 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

It's easy to install egenix-mx-base in Zope.

On Windows just download the .exe installer file and open
it with WinZIP. Then extract the file to <zopedir>\lib\python\.

On Linux, first build from source:

	python setup.py bdist_zope

and then unzip the generated archive
dist/egenix-mx-base-2.0.4.linux-i686.zip in <zopedir>.

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/