Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subtract two times
Message
From
22/12/2004 04:26:12
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
00971289
Message ID:
00971301
Views:
19
hi,
thank you for reply,
i try to but it as newmethod at my form i call it as TIM
i put my code at command bottom1 as under ,but i get 2error messag 1. variable NSECS not found, and file sectotime.prg dose not exist.
USE newdnc
thisform.text9.value=time()&& i a ctivate it at the begining run
thisform.text13.value=time() && after seconds i activate it via command bottom1.
 
thisform.TIM
thisform.text3.value=SecToTime(thisform.text13.value-thisform.text9.value)
replace time1 with thisform.text9.value,;
        time2 with thisform.text13.value,;
        time3 with thisform.text14.value

 LOCAL c_hours, c_min, c_znak
   IF nSecs == 0
       RETURN ""
    ENDIF
    c_znak  = IIF(nSecs < 0, "-","")
    nSecs   = ABS(nSecs)
    c_hours = INT(nSecs/3600)
    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_znak+c_hours+":"+c_min &&+":"+nSecs
thanks.
m.qasem



>When you susbtract times, the result is seconds, You must convert seconds to Time string, before replace
>
>thisform.text1.value=ftime()
>thisform.text2.value=stime()
>thisform.text3.value=SecToTime(thisform.text2.value-thisform.text1.value)
>replace time1 with thisform.text1.value,;
>        time2 with thisform.text2.value,;
>        time3 with thisform.text3.value
>
>FUNCTION SecToTime(nSecs)
>   LOCAL c_hours, c_min, c_znak
>   IF nSecs == 0
>       RETURN ""
>    ENDIF
>    c_znak  = IIF(nSecs < 0, "-","")
>    nSecs   = ABS(nSecs)
>    c_hours = INT(nSecs/3600)
>    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_znak+c_hours+":"+c_min &&+":"+nSecs
>
>
>>hi all,
>>
>>how i can subtract two times at myform, and replace first time,second time and result time at mytable, as under
>>
>>thisform.text1.value=ftime()
>>thisform.text2.value=stime()
>>thisform.text3.value=thisform.text2.value-thisform.text1.value
>>replace time1 with thisform.text1.value
>>replace time2 with thisform.text2.value
>>replace time3 with thisform.text3.value
>>
>>
>>
>>thanks
>>m.qasem
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform