03-21-2013 03:41 PM
What is the problem with the next piece of code?
QDateTime pub = QDateTime::fromString("20 Mar 2013", "dd MMM yyyy");
I just don't get it...
Solved! Go to Solution.
03-21-2013 03:56 PM
It looks like that function is dependent on the language setting of the device. I support 4 different languages, but the timestring I get from the datasource is always the same. So how can I convert my date decently in all the languages?
QDateTime::fromString("Wed, 20 Mar 2013 17:17:00", "ddd, dd MMM yyyy hh:mm:ss");
This works if my locale is set to english. But when I set it to dutch, it will not work. How to solve this annoying problem?
03-21-2013 04:27 PM
I found a solution for this one.
QLocale loc(QLocale::English); QDateTime dateTime = loc.toDateTime("Wed, 20 Mar 2013 17:17:00", "ddd, dd MMM yyyy hh:mm:ss");
This way, the date will always be interpreted as an english date offcourse.