|
-
March 27th, 2001, 07:16 PM
#1
Calculating Age
This has been re-posted from another list, so sorry if you're seeing it twice.
I am having trouble with DateTime and TimeSpan classes. I need a function
that calculates the number of Years (integral value) between two dates.
The TimeSpan looked promising, but alas the largest unit returned is days.
Int32 AgeInYears( DateTime startDate, DateTime endDate )
{
/* Help, ugh! */
}
Just to be safe, targetDate1.Year - startDate.Year is not sufficient as it
is not the difference in between the nominal years I am interested in. Rather, I want to get
at the number of years in the span between the target and the start. Also,
just using the TimeSpan.Day and assuming that 365 days = 1 year does not work
either as leap years would be ignored, etc.
TIA!
Aaron
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
|