KF5: Parsing times with timezone abbreviations

Thiago Macieira thiago at kde.org
Mon Mar 31 02:08:48 BST 2014

Em seg 24 mar 2014, às 04:33:34, Kevin Kofler escreveu:
> Hi,
> what is the recommended way to parse times with short timezone
> abbreviations, such as "16:00 CET", in Qt 5 / KF5 land? (I am asking because
> this is the format the BBC is using for weather observation times in their
> RSS files.)
> In kdelibs 4, this should do what we want:
> dateTime = KDateTime::fromString(timeString, "%H:%M
> %Z").toLocalZone().dateTime(); but KDateTime is deprecated in KF5.

Time zone abbreviations are useless, since they are not unique. Simply strip 
them out of your string before passing to QDateTime.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

More information about the kde-core-devel mailing list