In the above routine when i calculate the diff i am getting one year extra than the actual year. Please give the correct solution.Y=Field(Oconv(D1, "D-YMD[4,2,2]"),'-',1)-Field(Oconv(D2, "D-YMD[4,2,2]"),'-',1)
Mon=Field(Oconv(D1, "D-YMD[4,2,2]"),'-',2)-Field(Oconv(D2, "D-YMD[4,2,2]"),'-',2)
If Substrings(Mon,1,1)='-' Then
M=12-Field(Mon,'-',2)
End
If Substrings(Mon,1,1)<>'-' Then
M=Mon
End
If M=0 Then
Ans=Y
End
If M>0 Then
Ans= Y:'.':M
End
Any answer can be appreciated.
thanks in advance