A
Alex
I need to calculate the number of days between two dates formatted yyyymmdd.
Besides creating a whole date class, is there a simpler method of doing it?
for example:
20050203 - 20050201 = 2
right now what I have is
string sdate1 = "20050203";
string sdate2 = "20050201";
string date = date1 .substr(6.2);
int ndate1 = atoi(sdate1.c_str());
date = date2 .substr(6.2);
int ndate2 = atoi(sdate2.c_str());
//calculate how many days are missing
days = ndate1 - ndate2 ;
which just gets me the difference between dates without taking into account
month and year and leap year. Any suggestions would be appreciated.
Thanks!
Besides creating a whole date class, is there a simpler method of doing it?
for example:
20050203 - 20050201 = 2
right now what I have is
string sdate1 = "20050203";
string sdate2 = "20050201";
string date = date1 .substr(6.2);
int ndate1 = atoi(sdate1.c_str());
date = date2 .substr(6.2);
int ndate2 = atoi(sdate2.c_str());
//calculate how many days are missing
days = ndate1 - ndate2 ;
which just gets me the difference between dates without taking into account
month and year and leap year. Any suggestions would be appreciated.
Thanks!