Dates problem

I'm a beginner and I have a question. I have three variables:
int year, month, day
and I need to add an int number of days and it needs to return the date with those days added.
For example: (2021/01/31) + 3 days, needs to return: 2021/02/03.
I didn't find anything that I can handle dates on Arduino easily.
Can anyone help me with any ideas? Some lib, maybe. I didn't find anything.

Thanks.

The answer is very similar to that of the question asked in this thread (see Reply #2): how do you calculate base 60 pertaining to a clock? (not a timer) - #3 by aarg - Programming Questions - Arduino Forum
Only difference is that you need to a 32-bit value of seconds instead of subtract.

I have three variables:

Suppose that you only had 1 variable, such as the number of seconds that have elapsed since some fixed date in the past, say 00:00:00 UTC on 1 January 1970 until the date in question and a function to convert that number into a date, then the calculation would be easy, wouldn't it ?

Investigate using the Unix epoch and the TimeLib library

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.