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

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

XMLWordPrintable

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

      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).

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

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

              Created:
              Updated:

                There is 1 open Gerrit change