[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: KF5: Parsing times with timezone abbreviations
From: Kevin Kofler <kevin.kofler () chello ! at>
Date: 2014-03-24 3:33:34
Message-ID: lgo920$4sd$1 () ger ! gmane ! org
[Download RAW message or body]
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.
I looked at:
* QDateTime, but neither of the 2 QDateTime::fromString overloads in Qt 5.2
support the needed format, at least according to the documentation. The
one that takes a string does not support time zones (or so the
documentation says), the one that takes an enum entry does not support the
required format either.
* QTimeZone, but I cannot find a straightforward (documented) way to get a
QTimeZone from only the short abbreviation. I guess one could go through
all the availableTimeZoneIds and checking if the abbreviation matches, but
that won't necessarily give the expected (most probable) result
(especially if the abbreviation is not unique), will it?
Kevin Kofler
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic