odbc DbiDate date conversion

Frank Millman frank at chagford.com
Tue Sep 26 10:56:00 EDT 2006


flupke wrote:
> Frank Millman schreef:
> > flupke wrote:
> >> I'm using a solid DB and i'm accessing it via the odbc module
> >> (activepython).
> >> I get a DbiDate object returned but i don't find a way to decently print
> >> it or get a format like %d/%m%/%y.
> >>
> >
> > I convert it to a datetime() instance, like this -
> >
> >     mydate = datetime.datetime.fromtimestamp(int(dbidate))
> >
> > Then I can use all the functionality of the datetime module.
> >
> > HTH
> >
> > Frank Millman
> >
>
> Hi Frank,
>
> i tried it and i end up with this:
>
> >>> mydate = datetime.datetime.fromtimestamp(int(birthd))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ValueError: timestamp out of range for platform localtime()/gmtime()
> function
>

Well waddyaknow - I get exactly the same, for dates earlier than
1970-01-02. Thanks for finding a bug that would have bitten me sooner
or later.

I will do some investigation. If I find an answer I will post it here,
unless some kind soul saves me the trouble and beats me to it.

Frank




More information about the Python-list mailing list