Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get integer from QTimeZone return value (enum)? [SOLVED]



  • Hey,

    I would like to use QTimeZone to check whether we have summer or winter time.
    Therefore QTimeZone shall take the current system time zone.

    I found QTimeZone::TimeType which looks like what I am looking for.
    It returns an enum, but I don´t know how to use the return value.

    Please see the code:

    QTimeZone myTimeZone = QTimeZone::systemTimeZone();
    int i= myTimeZone.TimeType; //Not working. How is it right?
    

    Thank you very much :-)



  • Hi!

    const QDateTime now = QDateTime::currentDateTime();
    const bool isDaylightSavingTime = now.isDaylightTime();
    


  • Thank you very much :-)


Log in to reply