Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Android][iOS] Cannot get timezone
Forum Updated to NodeBB v4.3 + New Features

[Android][iOS] Cannot get timezone

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kolegs
    wrote on last edited by
    #1

    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");
    qDebug()<<local.timeZone();
    double offset = local.timeZone().standardTimeOffset(local); //offset=0@

    1 Reply Last reply
    1
    • K Offline
      K Offline
      kolegs
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved