Important: Please read the Qt Code of Conduct -

[Android][iOS] Cannot get timezone

  • Hi,

    I need to get timeoffset from UTC, but got problem getting current timezone. I use the code below. Anyone know how to do it?

    BTW, using the same code on Linux works just perfect. Oh and I am sure the timezone is set correctly on android, I set it manually.

    @ QDateTime UTC(QDateTime::currentDateTimeUtc());
    QDateTime local(UTC.toLocalTime());
    qDebug()<<UTC.toLocalTime().toString("yyyy-MM-dd hh:mm:ss");
    double offset = local.timeZone().standardTimeOffset(local); //offset=0@

  • on iOS it's even better, after getting current timezone and printin it do qDebug(it reads it perfectly) my app crashes in QTimeZone destructor, not sure which line exactly because debug shows only some assembler lines

Log in to reply