FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

selisih hari




FUNCTION nAge
PARAMETER frmdate, todate
LOCAL nyears, nmonths, ndays, cage, tdate, balik
IF todate<frmdate
balik = .T.
tdate = todate
todate = frmdate
frmdate = tdate
ENDIF
nyears = YEAR(todate)-YEAR(frmdate)
nmonths = 0
IF nyears>2
nyears = nyears-2
tdate = GOMONTH(frmdate, nyears*12)
ELSE
nyears = 0
tdate = frmdate
ENDIF
DO WHILE .T.
tdate = GOMONTH(tdate, 1)
IF tdate>todate
EXIT
ENDIF
nmonths = nmonths+1
ENDDO
ndays = todate-GOMONTH(tdate, -1)
IF nmonths>12
nyears = nyears+INT(nmonths/12)
nmonths = MOD(nmonths, 12)
ENDIF
nAge = (nyears*360)+(nmonths*30)+ndays
IF balik
nAge = nAge*-1
ENDIF
RETURN nAge
ENDFUNC



1 blog comments below

thanks Smile
tonynorte on Fri Jan 20, 2012 8:00 pm



FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.