Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate number of months
Message
From
27/08/2002 15:21:02
 
 
To
27/08/2002 14:33:39
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00694170
Message ID:
00694199
Views:
14
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
Map
View

Click here to load this message in the networking platform