Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subtract two times
Message
From
07/01/2005 17:26:35
 
 
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:
00975286
Views:
18
Hi Mohammed,

all your time related calculations are very simple in deed, but unless you understand how this works, you will waste a lot of time. You MUST understand/realize that you in your case always have to do your calculations with seconds. I mean, you have to convert your hh:mm:ss into seconds, then add/substract/multiply/divide or whatever with the seconds, and then convert the seconds back to hh:mm:ss again. If you look through the different functions other people have sent you, you have received a function to convert hh:mm:ss into seconds, and also a function to convert seconds into hh:mm:ss. So the rest should be easy.

NB! I don't mean to be rude to you, I only want to help you to understand how you must analyze your problem to be able to solve it.

>hello Mr.Borislav,
>i need to sum time for text1+text2+text3+text4+text5..to myform text12 maybe more 5 text.
>i try to add new things at your code but i get error masseg ,
>
>LPARAMETERS nSecs, nSec2,nSec3.....
>   LOCAL c_hours, c_min, c_znak, nLocSec
>   IF TYPE("nSecs") # "C" .OR.;
>      TYPE("nSec2") # "C" .OR.;
>      TYPE("nSec3") # "C" .OR.;&&& i get error message
>      TYPE("nSecs") # TYPE("nSec2")
>      TYPE("nSecs") # TYPE("nSec3")&&
>      RETURN ""
>   ENDIF
>
>   nLocSecs = VAL(LEFT(nSec2,2))*3600
>   nLocSecs = VAL(LEFT(nSec3,2))*3600&&
>   nLocSecs = nLocSecs + VAL(SUBSTR(nSec2,4,2))*60+ VAL(SUBSTR(nSec2,7,2))
>   nLocSecs = nLocSecs + VAL(SUBSTR(nSec3,4,2))*60+ VAL(SUBSTR(nSec3,7,2))&&&
>   nLocSecs = nLocSecs + (VAL(LEFT(nSecs,2))*3600 + VAL(SUBSTR(nSecs,4,2))*60+ VAL(SUBSTR(nSecs,7,2)))
>
>   nSecs   = ABS(nLocSecs)
>   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
>*RETURN c_znak+c_hours+":"+c_min+":"+nSecs
>
>
>and i try this code at mycommand ,i get error message
>
>thisform.totaltxt.value = thisform.addTIMe(thisform.text3.value,thisform.text2.value, thisform.text1.value)
>
>i need your help,
>thanks.
>m.qasem
Previous
Reply
Map
View

Click here to load this message in the networking platform