[Zope] PrincipiaTime with MS-Access ODBC data
Christian Tismer
tismer@appliedbiometrics.com
Fri, 05 Feb 1999 15:58:11 +0100
Brad Clements wrote:
>
> I have an Access database that I get to via ODBC. One of the columns
> is type "Date/Time".
This means that you get a DbiDate object, assuming that you use
the standard odbc interface.
I looked into the DateTime.py module. It appears to me as if
it tries to build a DateTime from such a dbi object.
>
> I want to see if a record is "recent", as in the previous 7 days.
>
> I've tried various things, where DocumentTime is the Date/Time field
> type...
>
> <!--#if "PrincipiaTime() - PrincipiaTime(DocumentTime) < 7"-->
I never used this and I'm very new to Zope, but I would try
to wrap float() around it if that helps. The DateTime doc says
that for a single float argument, it is interpreted as
the output of time.time().
Then, a warning:
With dbi, you cannot express dates before 1970. Access allows
dates from about 1900. This has the weird effect that
the DbiDate object will get an internal value of -1, and str()
will give you some ugly string from memory but nothing useful.
If you have such dates, I'd recommend to switch to the COM
interface, either by DAO, or the new general ADO interface which
should work with all odbc sources.
ciao - chris
--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.skyport.net
10553 Berlin : PGP key -> http://pgp.ai.mit.edu/
we're tired of banana software - shipped green, ripens at home