Hi,
anyone know a function to compare two hours ?
Imagine you have cTime1="10.55" and cTime2="13.44",
is there a function to know if cTime1>cTime2 ?
Thanks in advance
Local cTime1 := "10:00"
Local cTime2 := "13:20"
If TimeAsSeconds( cTime1 ) <= TimeAsSeconds( cTime2 )
....
EndIf
FUNCTION TimeAsSeconds( cTime )
RETURN VAL( cTime ) * 3600 + VAL( SUBSTR( cTime, 4 ) ) * 60 + VAL( SUBSTR( cTime, 7 ) )
Imagine you have cTime1="10.55" and cTime2="13.44",
is there a function to know if cTime1>cTime2 ?
lOK := .F.
nTIME1 := VAL("10.55")
nTIME2 := VAL("13.44")
nDIFF := nTIME1 - nTIME2
IF nDIFF > 0
lOK := .T.
ELSE
lOK := .F.
ENDIF
RETURN(lOK)
Marco Turco wrote:Hi,
anyone know a function to compare two hours ?
Imagine you have cTime1="10.55" and cTime2="13.44",
is there a function to know if cTime1>cTime2 ?
Thanks in advance
Function DRazlika(dStartDate,cStartTime,dEndDate,cEndTime)
Return (((dEndDate - dStartDate) * 86400) - TimeToSec(cStartTime)) + TimeToSec(cEndTime)
//*** End_Time, Start_Time are string ("12:15", "13:15")
dd2 :=alltrim(End_Time)
dd1 :=alltrim(Start_Time)
dd3 :=DRazlika(@StartDate,@dd1,@End_Date,@dd2) //*** Return dd3 in seconds
dd4 :=int(dd3/86400) //*** No of days
dd5 :=dd3-(dd4*86400)
dd6 :=int(dd5/3600) //*** No in hours
dd7 :=(dd5-dd6*3600)/60 //*** rest in minutes
...
...
@ row ,4 say "Result: "+str(dd4,2)+" days "+str(dd6,2)+" hours "+str(dd7,2)+" min"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 66 guests