ODBC / DBI help (via Win32 Extensions)

Andy Smith andy at ictibroker.com
Sat Apr 29 11:46:01 EDT 2000


Hi,

Calling the str method on a dbiDate will return a human-readable date.
Also, calling int(myDbiDate) will return a 'seconds since the epoch'
integer, which you can then easily work with using the functions in the
'time' module. I confess there may be methods of a dbiDate that can achieve
the same, but I'm happy enough to just convert them to integers ;)

Here's an operation on dbiDates that should help you get an access-friendly
format - (but remember to wrap in #'s cos that's crucial too!)

Regards,

Andy.

def dbToReuters(x):
    a = time.localtime(int(x))
    return time.strftime("%m/%d/%Y", time.localtime(int(x)))


Benjamin Schollnick <junkster at nospam.rochester.rr.com> wrote in message
news:rNHvjEdhm5Pp-pn2-RytgtQHbLg9d at d185d18f2.rochester.rr.com...
> ====================================================
>           (Remove "NoSpam" to Email me)
> ====================================================
> Hi All,
>
> I'm doing some MS Access/SQL work via the ODBC & DBI
> modules... and it's working great...
>
> I've got the read, and most of the "write" functions working
> fine, except when it comes to utilizing the date values...
> I can read and convert the date information into a python readable
> value.... But I can't seem to do an UPDATE or INSERT INTO command
> with a date value inside it.
>
> Can someone possibly post a example, or a fragment of a
> working  UPDATE / INSERT INTO command?  Or point me to some
> python resources that might assist?
>
> I've checked the ODBC how-to's on the python web site, and
> they don't even touch on the subject of WRITING a date... The examples
> on reading were very informative, but obviously I'm doing something
> wrong.
>
> - Benjamin
>
> ====================================================
>           (Remove "NoSpam" to Email me)
> ====================================================
> Please feel free to copy any and or all of this sig.
> A little something for spam bots:
>
> root at localhost postmaster at localhost admin at localhost
> abuse at localhost postmaster at 127.0.0.1
>
> Chairman William Kennard: bkennard at fcc.gov
> Commissioner Susan Ness: sness at fcc.gov
> Commissioner Harold Furchtgott-Roth: hfurchtg at fcc.gov
> Commissioner Michael Powell: mpowell at fcc.gov
> Commissioner Gloria Tristani: gtristan at fcc.gov
> consumerline at ftc.gov
> fccinfo at fcc.gov
> ssegal at fcc.gov
>





More information about the Python-list mailing list