[CPP] Parse Date/Time with timezone offset and convert to local time

Hi,

i would like to parse the following String “2020-10-14T21:22:24+02:00” to a QDateTime Object for the Timezone “Europe/Berlin” (or the Timezone of the Phone). The question how can i do this. I always seem to get the wrong local time. With Java (my primary language) this works fine and i get the expected result (-> “14.22.2020 21:10:24”) :

ZonedDateTime zdt = ZonedDateTime.parse(“2020-10-14T21:22:24+02:00”);
ZoneId swissZone = ZoneId.of(“Europe/Berlin”);
ZonedDateTime germanDate = zdt.withZoneSameInstant(swissZone);
LocalDateTime german = germanDate.toLocalDateTime();

However with Qt/CCP i do not get the same result - the offset always seems to be added
to the given time, not respecting my timezone:

QDateTime utcDateTime = QDateTime::fromString(utcDateTimeString, Qt::ISODate);
QDateTime localDateTime = QDateTime(utcDateTime.date(), utcDateTime.time(),
Qt::UTC).toLocalTime();

=> “2020-10-15 00:22:24”

i just don’t understand the Qt Documentation and i also could not find any decent examples.

Any help is appreciated.