time calculations

Pop Tufty poparosa at aol.com
Wed Sep 13 14:24:50 EDT 2000


I am looking for a package that will allow me to
perform calculations on time variables.  I am
accessing a MySQL database with MySQL
timestamps for events, and I want to know
how many hours ago these events happened.

I have something such as:

import MySQL
DBH = MySQL.connect();
DBH.selectdb('mydb');
STH = DBH.query("select Time from tablea")
for row in STH.fetchrows():
    event_time = row[0]
    ..
    .. and now I want to compare this with the current
    .. time to see how old this event is.

Does anyone have any suggestions on how to go about
doing this - I would rather not have to write a time string
parser...

thanks






More information about the Python-list mailing list