Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subtract two times
Message
 
To
07/01/2005 17:04:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
00971289
Message ID:
00975282
Views:
15
Mohamme,
You can redefine the Method to returns whatever You want, So You can Use it to returns seconde instead of time Something like this:
LPARAMETERS nSecs, nSec2, seconds_return
LOCAL c_hours, c_min, c_znak, nLocSec
IF TYPE("nSecs") # "C" .OR.;
   TYPE("nSec2") # "C" .OR.;
   TYPE("nSecs") # TYPE("nSec2")
    RETURN IIF(seconds_return,0,"")
ENDIF
nLocSecs = VAL(LEFT(nSec2,2))*3600
nLocSecs = nLocSecs + VAL(SUBSTR(nSec2,4,2))*60+ VAL(SUBSTR(nSec2,7,2))
nLocSecs = nLocSecs + (VAL(LEFT(nSecs,2))*3600 + VAL(SUBSTR(nSecs,4,2))*60+ VAL(SUBSTR(nSecs,7,2)))

nSecs   = ABS(nLocSecs)
IF seconds_return
   RETURN nSecs
ENDIF
c_hours = INT(nSecs/3600)
IF c_hours > 24
   RETURN ""
ENDIF
nSecs   = nSecs - (c_hours*3600)
c_hours = IIF(c_hours<10,"0","")+ALLTRIM(STR(c_hours,15))
c_min   = INT(nSecs/60)
nSecs   = nSecs - (c_min*60)
c_min   = IIF(c_min<10,"0","") + ALLTRIM(STR(c_min,15))
nSecs   = IIF(nSecs<10,"0","") + ALLTRIM(STR(nSecs,10))
RETURN c_hours+":"+c_min+":"+nSecs
Then You can use it:


thisform.AddTime(thisform.AddTime(thisform.Text1.Value, thisform.Text2.Value, .t.), thisform.Text3.Value)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform