DATEDIFF Challenge: REAL YEAR.

# Thread: DATEDIFF Challenge: REAL YEAR.

1. Senior Member
Join Date
Dec 1969
Posts
590

## DATEDIFF Challenge: REAL YEAR.

I did a datediff("yyyy".. to find the number of<BR>years between two dates. But this just calculates<BR>the difference in the years, and does not take into<BR>account the month or days.<BR><BR>I guess I could do a Day difference, then divide<BR>by 365. But what about the leap years, or the years<BR>that don&#039t have exactly 365 days.<BR><BR>Anyone know how to do this?

2. Ramakrishna/ Murthy Guest

## RE: DATEDIFF Challenge: REAL YEAR.

intNoDays = DateDiff("d", "01/01/97", "01/01/99")<BR>intNoMonths = DateDiff("m", "01/01/97", "01/01/99")<BR>intNoYears = DateDiff("yyyy", "01/01/97", "01/01/99")<BR>check this out !!<BR><BR>any kind of doubts u can always rely on us<BR><BR>cheers <BR>Rama/murthy

3. Ramakrishna/ Murthy Guest

## RE: DATEDIFF Challenge: REAL YEAR.

intNoDays = DateDiff("d", "01/01/97", "01/01/99")<BR>intNoMonths = DateDiff("m", "01/01/97", "01/01/99")<BR>intNoYears = DateDiff("yyyy", "01/01/97", "01/01/99")<BR>check this out !!<BR><BR>any kind of doubts u can always rely on us<BR><BR>rk_mirage@usa.net<BR>murthypinisetty@usa .net<BR><BR>cheers <BR>Rama/murthy

4. Ramakrishna/ Murthy Guest

intNoDays = DateDiff("d", "01/01/97", "01/01/99")<BR>intNoMonths = DateDiff("m", "01/01/97", "01/01/99")<BR>intNoYears = DateDiff("yyyy", "01/01/97", "01/01/99")<BR>check this out !!<BR><BR>any kind of doubts u can always rely on us<BR><BR>rk_mirage@usa.net<BR>murthypinisetty@usa .net<BR><BR>cheers <BR>Rama/murthy

5. Ramakrishna/ Murthy Guest

## DATEDIFF Challenge: Achieved

intNoDays = DateDiff("d", "01/01/97", "01/01/99")<BR>intNoMonths = DateDiff("m", "01/01/97", "01/01/99")<BR>intNoYears = DateDiff("yyyy", "01/01/97", "01/01/99")<BR>check this out !!<BR><BR>any kind of doubts u can always rely on us<BR><BR>rk_mirage@usa.net<BR>murthypinisetty@usa .net<BR><BR>cheers <BR>Rama/murthy

6. Senior Member
Join Date
Dec 1969
Posts
1,315