how do you integrate a date adding a year per loop. for example you start out in 2006 and it runs 5 times and you end up in 2010
how do you loop through date
Collapse
X
-
What data type are you using to hold the date? For instance if you are using time_t which holds the date as seconds since 1/1/1970 00:00:00 then all you need to do is add the number of seconds in each year (noting that a leap year has an extra day) for each loop iteration.
If you are using a struct tm then you can just increment the year but will need to verify the day/month is still valid if you started on a leap day.
Windows uses another time system holding 100nanosecond increments since some other date but again you just need to add the number of increments in the year.
Comment