Hi folks,
this has to be something very simple but I don't know what I do wrong:
QString str
= "23/02/2024,00:46:52";
QString format
= "dd/mm/yyyy,hh:mm:ss";
qDebug() << "dt:" << dt << ",dt.isValid():" << dt.isValid();
QString str = "23/02/2024,00:46:52";
QString format = "dd/mm/yyyy,hh:mm:ss";
QDateTime dt = QDateTime::fromString(str, format);
qDebug() << "dt:" << dt << ",dt.isValid():" << dt.isValid();
To copy to clipboard, switch view to plain text mode
Output is:
dt: QDateTime(Invalid) ,dt.isValid(): false
I tried it on Qt-versions 4.8.7, 5.15.2 and 6.2.4.
All do the same! Why is that??? I also changed the str and the format a bit but still in will not do the desired...
Any hints?
Thx in advance
freeman_w
Added after 6 minutes:
OMG, the month formatting was wrong...
It should be "dd/MM/yyyy,hh:mm:ss"
I am sorry folks... I said it HAD to be very simple...
Bookmarks