I have been given a date, Which I am taking as an input like (day, month, year): 12, 03, 87
.
Now I need to find out the date after n
days.<
It might be easier to do the math using seconds since the epoch instead of manipulating the date fields directly.
For example, this program prints the date 7 days from now:
#include
#include
main()
{
time_t t;
struct tm *tmp;
time(&t);
/* add a week to today */
t += 7 * 24 * 60 * 60;
tmp = localtime(&t);
printf("%02d/%02d/%02d\n", tmp->tm_mon+1, tmp->tm_mday,
tmp->tm_year % 100);
}