[SOLVED]DateAndTime
-
I got this string from an xml file:
<timestamp>2012-02-23T10:32:00.50+01:00</timestamp>And I want to split this in the apropriate time and date format.
I want to have the date in this format 2012-02-23
And Time in this 10:32:00Is the best way to split the string to a string list and parse it to the QDate.fromString();
The same with time.Or Is there away to put this String in a QLocal obj or a QDateTime obj and just take the QDateTIme.date() and time() and get what I want.
I haven't found this in the docs but it's alitlebit strange because the format is common.
-
Did you see "QDateTime::fromString":http://developer.qt.nokia.com/doc/qt-4.8/qdatetime.html#fromString and "QDateFormat":http://developer.qt.nokia.com/doc/qt-4.8/qt.html#DateFormat-enum ?
-
You can read "here":http://developer.qt.nokia.com/doc/qt-4.8/qdatetime.html#fromString and "here":http://developer.qt.nokia.com/doc/qt-4.8/qt.html#DateFormat-enum about it.
Try:
@QDateTime timeStamp = QDateTime::fromString(yourTimestampString, Qt::ISODate);@Edit: Aww, I'm too late ;-).
-
Thank you all for your help.
Works perfect;