Selisih Waktu pada Visual Foxpro

FUNCTION Time2Time(cTime1,cTime2)
LOCAL cJam,nJam, nMenit, nDetik, nDetik1, nDetik2, nDetik3
*
nDetik1 = VAL(SUBSTR(cTime1,1,2))*3600+VAL(SUBSTR(cTime1,4,2))*60+VAL(SUBSTR(cTime1,7))
nDetik2 = VAL(SUBSTR(cTime2,1,2))*3600+VAL(SUBSTR(cTime2,4,2))*60+VAL(SUBSTR(cTime2,7))
*
nDetik3 = ABS(nDetik2-nDetik1)
nJam = INT(nDetik3/3600)
nMenit = INT((nDetik3-nJam*3600)/60)
nDetik = nDetik3-nJam*3600-nMenit*60
*
cJam = RIGHT(’00’+LTRIM(STR(nJam)),2)+’:’+RIGHT(’00’+LTRIM(STR(nMenit)),2)+’:’+RIGHT(’00’+LTRIM(STR(nDetik)),2)
RETURN cJam
ENDFUNC

http://fox-id.org/smf/index.php?action=printpage;topic=6752.0

Advertisements