QT 4.4 and timedelta

admoore me at alandmoore.com
Mon Aug 25 18:48:45 CEST 2008


Maybe I'm missing something obvious, but is there a QT object to
represent time intervals, a la datetime.timedelta?

I'm working on a utility that displays database query results from a
postgres database (using psycopg2) in a QTableView.  For columns
created using "age(some_date_column)", I get a datetime.timedelta
object from psycopg2.

What I'd like is to be able to format this column in a friendly way
(say "7 years, 2 months, 4 days"), yet have the QTableView treat it
properly (e.g. for sorting purposes, not sorting it lexically but by
the actual length of time).

Anyone have any input or ideas on this?



More information about the Python-list mailing list