Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-77721

Add a function to QDate to calculate the difference to another date

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P4: Low
    • None
    • None
    • Core: Other
    • None

    Description

      Qt currently lacks date calculation functions (like e. g., to mention a nice example, Python has), esp. the possibility to calculate the difference to another date other than the days between.

      In my case, I needed the years, months and days between two dates. It's always quite tricky to do such calculations (but they are often needed I think), so it would be nice if some function to do this calculation was added to QDate ditrectly (like QDate::differenceTo(const QDate &other) or such).

      The function I implemented is quite short, but it took me quite some time to get it right (and I hope it calulates correctly). Maybe you want to use this (probably as an inspiration).

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-77721
          # Subject Branch Project Status CR V

          Activity

            People

              Eddy Edward Welbourne
              l3u Tobias Leupold
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change