There are lines containing time, for example, "Tue Jun 22 16:40:19 +0000 2010". "+0000" is present in all lines. I want to translate all this into QDateTime using

 QDateTime::fromString ( const QString & string, const QString & format ) 

Help create a template for such lines. Of course, there is a Qt manual, but everything is somehow muddy explained there.

    1 answer 1

    Most likely, parsing with the help of this command alone will not work. It is necessary to break the line into 3 fields - extract the UTC offset + XXXX and process it separately. This can be done using QString functions or use heavier artillery in the form of regexps.

    • one
      And add: do not forget about QLocale, and then QDateTime will be expected in the line Вс. апр. 22 Вс. апр. 22 Вс. апр. 22 instead of Sun Apr 22 . - northerner