FUNCTION CalcTiempo( dFchIni , dFchFin )
local anios,meses,dias,nAni,nMes
nDiaI := DAY( dFchIni )
nMesI := MONTH( dFchIni )
nAniI := YEAR( dFchIni )
nDiaF := DAY( dFchFin )
nMesF := MONTH( dFchFin )
nAniF := YEAR( dFchFin )
anios := nAniF - nAniI
meses := nMesF - nMesI
dias := nDiaF - nDiaI
IF meses < 0
anios = anios - 1
meses = meses + 12
ENDIF
IF dias < 0
meses = meses - 1
nAni = nAniF
nMes = nMesF
IF ( (nMesF - 1) = 0 )
nAni = nAni - 1
nMes = 12
ELSE
nMes = nMes - 1
ENDIF
dias = dias + DIASXMES(nAni,nMes)
ENDIF
RETURN { anios , meses , dias }
FUNCTION DIASXMES(nAni,nMes)
LOCAL aDiasxMes[12]
aDiasxMes[1]=31
aDiasxMes[2]=28
aDiasxMes[3]=31
aDiasxMes[4]=30
aDiasxMes[5]=31
aDiasxMes[6]=30
aDiasxMes[7]=31
aDiasxMes[8]=31
aDiasxMes[9]=30
aDiasxMes[10]=31
aDiasxMes[11]=30
aDiasxMes[12]=31
IF MOD(nAni,4) == 0
aDiasxMes[2] = 29
ENDIF
RETURN aDiasxMes[nMes]