Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDateTime and Time Zones
Qt 6.12 LTS is out! See what's new in the release blog

QDateTime and Time Zones

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.4k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello there,

    In a current development, we were not originally aware that QDateTime takes into account system time zones. When processing large sets of data that are related by time, we began finding our times were an hour off due to the way we set the times (there is a need to having a starting date at the first second of the year, then add seconds to get the desired date/time).

    Now, we have hundreds of references to QDateTime variables that we will need to go through and set to use the UTC time spec. Is there a more "global" way of changing the applications time spec, rather than needing to modify each instantiation of QDateTime objects?

    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      If you're running under Linux (or any POSIXish type system), you can set the environment variable TZ=UTC (if I remember correctly) before running your app.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Unfortunately, we are running on Windows...I guess I could just tell users to change their time zone to somewhere without DST ;) I wonder how that would fly!

        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
        • Unsolved