Calculating a date from a given date

I want to calculate a date thirty days in the future. So if i have a date like
1st January 2021, I want the day, the month, and the year such as 31st of January 2021.

I don't want to calculate the number of days between the dates, there are many examples of this on the web.



https://www.cplusplus.com/reference/ctime/mktime/
Like
1
2
3
4
  time ( &now );
  timeinfo = localtime ( &now );
  timeinfo->tm_mday += 30;
  mktime ( timeinfo );

Registered users can post here. Sign in or register to post.