the date/time/datetime format must be ISO
another way, if you don't what to change format in databse, you can use static method of QDate -- QDate::fromString and pass needed mask as the second parametr.QDate QVariant::toDate () const
Returns the variant as a QDate if the variant has type() Date, DateTime, or String; otherwise returns an invalid date.
If the type() is String, an invalid date will be returned if the string cannot be parsed as a Qt::ISODate format date.
See also canConvert() and convert().
Bookmarks