Calculate days between two dates

I want to calculate the number of days between two days.
manneAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vanbascoConnect With a Mentor Commented:
Well, I suggest you introduce a table containing the number of days for each month, for example days_in_this_month[];

For example, number of days (including both start and end-day) from January 13 to March 7:

int day_number = 0;

for (i=1; i<3;i++)
  day_number += days_in_this_month[i];

day_number -= (13-1);
day_number += 7;

//Hope this helps.
 
0
All Courses

From novice to tech pro — start learning today.