Qt World Summit: Submit your Presentation

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