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

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

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Open
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:
      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

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

          Activity

            People

            Assignee:
            Eddy Edward Welbourne
            Reporter:
            l3u Tobias Leupold
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There is 1 open Gerrit change