Congratulations to our 2022 Qt Champions!

Get next day QDate

  • Hello!
    I am making a QString in the format: YYMMDDHHmm
    (year-month-day of year-hour of day(24 hours format)-minute of hour)
    But I would like to take the next day from today. For example, if today is
    20123911515 (2012, 3 (March), 91th day of the year (31 of march), and its 15:15)
    then I will need
    20124921515 (i will need to change both the month and the day of the year, because today is the last day of the month)

    So, the main problem is, how will I detect that today is the last day of the current month? Also, more problems arise with leap years.

    Is there a safe way to take the next day's date with the above format?

    Thanks in advance for any answers...

  • QDate has a method call "addDays":
    Also QDateTime has "this method ":

Log in to reply