QDateTime::operator>=
Solved
General and Desktop
-
Hi,
Can someone point me to some examples of how to call QDateTime::operator>= . What I have is two QStrings, one with a date in it and one with a time in it. I want to compare those two variables to current date and time and execute code based upon results. I just can't seem to wrap my head around this.
Thanks
-
Hi,
Do you mean build a QDateTime using fromString and a QDateTime from a QTime::fromString and a QDate::currentDate and then compare them ?
-
Basically, I found this in the QT Docs.
bool QDateTime::operator>=(const QDateTime &other) const
Returns true if this datetime is later than or equal to the other datetime; otherwise returns false.
I just cannot find any other documentation on how to use that,
Thanks
-
It's just a bigger or equal operator:
QDateTime time1 = QDateTime::fromString(myDateTimeString); QDateTime time2 = QDateTime::currentDateTime(); if (time1 >= time2) { // Do some cool stuff }