|
-
May 3rd, 1999, 03:32 PM
#1
Calculating Months using a COleDateTimeSpan object
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
-
May 3rd, 1999, 07:22 PM
#2
Re: Calculating Months using a COleDateTimeSpan object
you can't do it like that, since months have different lengths
BTW, so do years
Sally
-
May 3rd, 1999, 07:26 PM
#3
Re: Calculating Months using a COleDateTimeSpan object
Yes, I realize that this piece of code doesn't work, but what I need is an algorithm that will work.
Do you have any suggestions?
- Troy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|