WxW
asked on
Calculating days in 360-format from SYSTEMTIME
Hi, I have 2 SYSTEMTIME structures and I know how to calculate the 365-day difference between them. (FILETIME int64 etc)
My problem is to calculate the total days in a 360-day format. Excel has a function Days360 which does that, but I couldn't find something in C++.
How to do it?
Regards
My problem is to calculate the total days in a 360-day format. Excel has a function Days360 which does that, but I couldn't find something in C++.
How to do it?
Regards
ASKER
And how to convert SYSTEMTIME to a time_t ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
int days360(time_t t1, time_t t2){
struct tm tm1,tm2,*tm;
tm1 = *localtime(&t1);
tm2 = *localtime(&t2);
if( tm1.tm_mday > 30 ){ tm1.tm_mday = 30; }
if( tm2.tm_mday > 30 ){ tm2.tm_mday = 30; }
return ((tm1.tm_year-tm2.tm_year)
}