Hello, I need to calculate Months using a COleDateTimeSpan object. With this object you can get days, hours, minutes, and seconds. I need to calculate Months. I have already added code that will calculate years, and weeks (which are both easy, just nDays * 365 (years) or nDays * 7 (weeks) but Months are more difficult).

Can anyone help me with a calculation? I was thinking about this, and tried it, but it didn't work properly:


double dYears = nTotalDays / 365.25;
int nMonths = (int)nYears * 12;




Thanks for any help that you can offer!

- Troy