Nominate our 2022 Qt Champions!

Getting time zone list from QTimeZone

  • I want to get Time zone list and for that I tried using QTimeZone as below,
    QList<QByteArray>timeZonesList = QTimeZone::availableTimeZoneIds();
    foreach (QByteArray id, timeZonesList)
    QTimeZone timeZoneForId(id);
    qDebug()<< timeZoneForId.displayName(QTimeZone::GenericTime) <<":::::::" <<id;

    I am getting very long list and its not exactly matching the time zone listed when we compare with time zone list displayed in windows date time setting -> time zone setting option.

    Please let me know. How to get the list of timezones matching with system timezone list display in system time zone setting dropdown option.

Log in to reply