[PyKDE] QDate compare probs

Ken Godee ken at perfect-image.com
Sun Feb 8 10:00:01 GMT 2004


I'm trying to figure out if one date's <= to the other
and having problems getting it to work.

The two dates are fetched out of a db ......

<DateTime object for '2004-02-07 00:00:00.00' at 8182e18>,
2004-02-07 00:00:00.00

<DateTime object for '2004-01-15 00:00:00.00' at 8295c28>
2004-01-15 00:00:00.00


convert to a QDate instance.........

cudate1 = QDate.fromString((cufill[13].strftime("%Y/%m/%d")), Qt.ISODate)

print cudate1
<qt.QDate instance at 0x8295d94>

print QDate.toString(cudate1)
Sat Feb 7 2004

Then I'm trying to do....

bool QDate::operator<= ( const QDate & d ) const

if cudate1 <= cudate2 :

At first if 1 <= 2, evals true
but changing db value of 1 to greater than 2, it still evals as true.

also, the same values eval different, ie. below
		    QDate.fromString(((lcdate[0][0]).strftime("%Y/%m/%d")), Qt.ISODate) \
<= QDate.fromString((cufill[13].strftime("%Y/%m/%d")), Qt.ISODate)

evals as 0

print cudate1 <= cudate2

evals as 1

arrrgggg!

I must be doing something wrong, any help would be great.





More information about the PyQt mailing list