I did a program that calculates the days different, between two dates, but I am not sure how can I add a statement that makes sure the program wont include the end date.
my code is calculating month and days but only printing days, its 86 days or 2 months and 25 days! how do i edit that so it shows 86?
This is a typical case of "Don't (try to) reinvent the wheel." Use the Standard C mktime function to convert broken-down times into time values which can be subtracted from each other.
#include
…
time_t t1, t2;
t1 = mktime(&(struct tm){ .tm_mday=dd1, .tm_mon=mm1-1, .tm_year=yyyy1-1900 });
t2 = mktime(&(struct tm){ .tm_mday=dd2, .tm_mon=mm2-1, .tm_year=yyyy2-1900 });
day_diff = (t2 - t1) / 24 / 60 / 60 + include; // make days from seconds