Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDate also encodes time of day?
Forum Updated to NodeBB v4.3 + New Features

QDate also encodes time of day?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 349 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.
  • C Offline
    C Offline
    clarify
    wrote on last edited by
    #1

    I'm wondering if QDate actually stores the time of day
    in addition to the date.
    QDate appears to be just a container for a 64-bit value.
    The QDate header file just points to qdatetime.h.
    If it does encode date+time, and it was possibly formerly qdatetime, why does it not provide methods for accessing time of day?

    JonBJ 1 Reply Last reply
    0
    • C clarify

      I'm wondering if QDate actually stores the time of day
      in addition to the date.
      QDate appears to be just a container for a 64-bit value.
      The QDate header file just points to qdatetime.h.
      If it does encode date+time, and it was possibly formerly qdatetime, why does it not provide methods for accessing time of day?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @clarify
      Why do you ask or care? It doesn't offer time of say because it's a date, not a datetime. There are QDate::startOfDay() and endOfDay() as the access point to a QDateTime, but nothing in-day.

      C 1 Reply Last reply
      1
      • JonBJ JonB

        @clarify
        Why do you ask or care? It doesn't offer time of say because it's a date, not a datetime. There are QDate::startOfDay() and endOfDay() as the access point to a QDateTime, but nothing in-day.

        C Offline
        C Offline
        clarify
        wrote on last edited by clarify
        #3

        @JonB
        I'm just a caring person, I suppose.
        But I do kind of wonder why it's not implemented as a struct.
        It's just a container of 1 value and some methods.
        It's a class that doesn't descend from any other class.

        JonBJ 1 Reply Last reply
        0
        • C clarify

          @JonB
          I'm just a caring person, I suppose.
          But I do kind of wonder why it's not implemented as a struct.
          It's just a container of 1 value and some methods.
          It's a class that doesn't descend from any other class.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @clarify
          If your question is about struct versus class in C++, there is no effective difference between them (other than minor point about public visibility), classes do not have to inherit, so that is not an issue.

          C 1 Reply Last reply
          0
          • JonBJ JonB

            @clarify
            If your question is about struct versus class in C++, there is no effective difference between them (other than minor point about public visibility), classes do not have to inherit, so that is not an issue.

            C Offline
            C Offline
            clarify
            wrote on last edited by
            #5

            @JonB
            There is also the question of adjusting for things like leap minutes added at the end of a year.

            https://arstechnica.com/science/2023/11/leap-seconds-could-become-leap-minutes-despite-pushback-from-russians-vatican/

            JonBJ 1 Reply Last reply
            0
            • C clarify

              @JonB
              There is also the question of adjusting for things like leap minutes added at the end of a year.

              https://arstechnica.com/science/2023/11/leap-seconds-could-become-leap-minutes-despite-pushback-from-russians-vatican/

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @clarify
              Sorry, don't see how that has anything to do with a QDate. A QDate is "defined" as a date with no time of day. If you want to deal with a datetime, use a QDateTime.

              1 Reply Last reply
              3

              • Login

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