> Dear
> Can help me it so important
> I want found the deferent between 2 date
> Example
> Date1 - Date2 = day-hour-minute-second
> 2008-09-09 11:55:12 - 2008-09-09 11:51:32= 04:02
>
> Waseem Waheeb
****Edited Post... After checkin the Anders Code i come to know that my code is wrong so just edited with write one!
hi Waseem
First your result should be 03:40 :)
LOCAL lDate1, lDate2,lDays,lH1,lH2,lm1,lm2,ls1,ls2,lHrs,lMinute,lSeconds,lText2Display
SET SECONDS ON
SET HOURS TO 24
ldate1 =CTOT([09.09.2008 11:51:32])
ldate2 =CTOT([09.09.2008 11:55:12])
LDAYS = TTOD(lDate2) - TTOD(lDate1)
lh1 =SUBSTR(TTOC(lDate1),12,2)
lh2 =SUBSTR(TTOC(lDate2),12,2)
lm1 =SUBSTR(TTOC(lDate1),15,2)
lm2 =SUBSTR(TTOC(lDate2),15,2)
ls1 =SUBSTR(TTOC(lDate1),18,2)
ls2 =SUBSTR(TTOC(lDate2),18,2)
lHrs= VAL(lh2) - VAL(lh1)
lMinute= VAL(lm2) - VAL(lm1)
lSeconds= VAL(ls2) - VAL(ls1)
IF lSeconds < 0
lMinute = lMinute -1
lSeconds = 60 +(lSeconds)
ENDIF
IF lMinute < 0
LHrs = lHrs -1
lMinute = 60+(lMinute)
ENDIF
IF lHrs < 0
LDAYS = lDays -1
lHrs = 24+(lHrs)
ENDIF
lText2Display = " Days = "+ALLTRIM(STR(lDays)) + " Hours "+ALLTRIM(STR(lHrs))+ " Minutes : "+ALLTRIM(STR(lMinute)) + " Seconds : "+ALLTRIM(STR(lSeconds))
MESSAGEBOX(lText2Display)
Anil
(Fox is the solution for almost everything!!)