473,408 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

QT 4.4 and timedelta

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?
Aug 25 '08 #1
1 1877
I'm not very sure about this , but it's logicallay enough to be said
i think the QTableView ordering mechanism must provide some overriding
functionality through accepting a comparing function from you
check it

On Mon, Aug 25, 2008 at 7:48 PM, admoore <me@alandmoore.comwrote:
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?
--
http://mail.python.org/mailman/listinfo/python-list
Aug 25 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Wil Schultz | last post by:
Hey all, Sorry, I am trying my best to learn python and seem to be able to grab somethings while others seem to escape me... I am trying to write a timedelta meter, i.e. "it has been U years, V...
0
by: josh | last post by:
Why can't timedelta arithmetic be done on time objects? (e.g. datetime.time(5)-datetime.timedelta(microseconds=3) Nonzero "days" of the timedelta could either be ignored, or trigger an...
0
by: josh | last post by:
datetime.time should support timedelta arithmetic, patch attached. Times greater than 24 hours should not raise an exception, but always wrap around. Any other behavior is too surprising. (People...
1
by: Florian Lindner | last post by:
Hello, I want to know if a certain duration is over. I try it like this with timedelta objects: d = datetime.timedelta(minutes = 2) t = time.gmtime() print (t + d < time.gmtime()) gives:
1
by: Philipp | last post by:
Hello Pythonistas I'm new to Python, I hope you understand my question. I would like to pass a parameter "gap" to a function. gap should be used there to create a timedelta Object. from...
5
by: Lad | last post by:
Hello, what is the best /easest way how to get number of hours and minutes from a timedelta object? Let's say we have aa=datetime.datetime(2006, 7, 29, 16, 13, 56, 609000)...
6
by: Carl J. Van Arsdall | last post by:
Basically I used the datetime module and timedelta objects to calculate a difference between two times. Now I'm trying to figure out how I make that time delta a string HH:MM:SS to show elapsed...
2
by: kath | last post by:
Hi, the following shows the contents of "datebook.xls" Date 8/9/2006 8/9/2006 8/9/2006 8/9/2006 8/9/2006
2
by: skip | last post by:
Running from Subversion, I see confusing (to me) behavior related to division of datetime.timedelta objects by integers: % python Python 2.6a0 (trunk:57277:57280M, Aug 28 2007, 17:44:49) on...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.