Originally Posted by
Elysia
Is there such a type as "days"?
Yep! Got it to compile now... One issue though, Is this function accurate? I mean should return_days calculation consider hours and minutes as well?
Code:
void Contract::CalculateNoOfDays(Date issue_dt, Date return_dt)
{
using namespace boost::gregorian;
std::ostringstream issue_dymonyr, return_dymonyr;
issue_dymonyr << issue_dt.getMonth() << "-" << issue_dt.getDay() << "-" << issue_dt.getYear();
return_dymonyr << return_dt.getMonth() << "-" << return_dt.getDay() << "-" << return_dt.getYear();
try {
date issuedDate(from_simple_string(issue_dymonyr.str()));
date returnDate(from_simple_string(return_dymonyr.str()));
days rental_days = returnDate - issuedDate;
}
catch(...) {
std::cout << "Bad date entered: " << issue_dymonyr.str() << return_dymonyr.str() << std::endl;
}
}
[EDIT}
Not forgetting how to convert from days to a normal integer value [/EDIT]