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

selisih hari hari/bulan/tahun




FUNCTION cage
PARAMETER frmdate, todate
LOCAL nyears, nmonths, ndays, cage, tdate
IF todate<frmdate
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
cage = IIF(nyears>0, ALLTRIM(STR(nyears))+" Tahun ", "")+IIF(nmonths>0, ALLTRIM(STR(nmonths))+" Bulan ", "")+IIF(ndays>0, ALLTRIM(STR(ndays))+" Hari", "")
RETURN cage
ENDFUNC



0 blog comments below




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