Ok I added 2 in the last but in that case also,consider one situation
comm_date=31/03/2011
Cur_date=31/03/2013
In this case year i.e Y should come as 2 and Days D as 1 i.e Y=2 and D=1 but D is comming as 2.
In some cases it is working correct while in some cases it is wrong
>>Sir,
>>Not working properly, If comm_date is 19/10/2011 and cur_date is 31/03/2013.
>>It should be 1 Year and 165 Days (13+30+31+31+29+31).
>>
>>Knidly Help
>>
>>
>>
>>>>I am looking for some command or code that could hep in getting the number of Years and Days between Two Dates.
>>>> For example, if commence_date='31/03/2011' and Current_date is '31/03/2013', I need Y=2 and D=1.
>>>>
>>>>Similarly if if commence_date='20/02/2012' and Current_date is '31/03/2013', I need Y=1 and D=41 ( as 2012 was a Leap Year).
>>>>
>>>>Kinldy Help
>>>
>>>
>>>CLEAR
>>>ldDate1 = DATE(2012, 2, 20)
>>>ldDate2 = DATE(2013, 3, 31)
>>>
>>>lnYears = YEAR(ldDate2) - YEAR(ldDate1)
>>>IF MONTH(ldDate2) < MONTH(ldDate1) OR;
>>> DAY(ldDate2) < DAY(ldDate1)
>>> lnYears = lnYears - 1
>>>ENDIF
>>>
>>>ldDate3 = GOMONTH(ldDate1, 12 * lnYears)
>>>
>>>lnDays = ldDate2 - ldDate3
>>>? "Y:", lnYears,"D:",lnDays
>>>
>>>
>>>NOT TESTED!!!
>
>
>If you want the first and last date to be included in calculations just add 2:
>
>lnDays = ldDate2 - ldDate3 + 2
>
Harsh