General information
Category:
Coding, syntax & commands
dear jerry,
is of any help to you ?
with regards.
*********
lparameters tdDate1, tdDate2
local lnYears, lnMonths, lnDays, ldTemp, ldCalcDate
IF parameters() < 1
RETURN replicate('0',8)
ENDIF
tdDate2 = IIF(empty(tdDate2),date(),tdDate2)
if tdDate2 < tdDate1
ldTemp = tdDate1
tdDate1 = tdDate2
tdDate2 = ldTemp
endif
lnMonths = floor((tdDate2-tdDate1)/31)
ldCalcDate = gomonth( tdDate1, lnMonths )
if ldCalcDate > tdDate2
ldCalcDate = tdDate1
lnMonths = lnMonths - 1
endif
do while gomonth( ldCalcDate, 1 ) <= tdDate2
ldCalcDate = gomonth( ldCalcDate, 1 )
lnMonths = lnMonths + 1
enddo
lnYears = int( lnMonths / 12 )
lnMonths = lnMonths - ( lnYears * 12 )
lnDays = tdDate2 - ldCalcDate
RETURN trans(int(lnYears * 10^4 + lnMonths * 10^2 + lnDays),'@R 9999/99/99')
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only