Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subtract two times
Message
De
22/12/2004 05:38:50
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7
Divers
Thread ID:
00971289
Message ID:
00971324
Vues:
20
hi,
thank you very much,it works with small problem .
i get the result as -00:0-1:0-38
i need it as 00:01:38
at mytable i put 3 fields as (date type)
and the 3 textbox as date type i get error message data type mismatch.
what type i must choice to insert it at mytable.
thanks.
m.qasem

>
>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.text14.value = thisform.TIM(thisform.text13.value, thisform.text9.value)
>replace time1 with thisform.text9.value,;
>        time2 with thisform.text13.value,;
>        time3 with thisform.text14.value
>
>
>***** Method TIM of the form
>   LPARAMETERS nSecs, nSec2
>   LOCAL c_hours, c_min, c_znak, nLocSec
>   IF .NOT. TYPE("nSecs") $"CT" .OR.;
>      .NOT. TYPE("nSec2") $"CT" .OR.;
>      TYPE("nSecs") # TYPE("nSec2")
>      RETURN ""
>   ENDIF
>
>   IF TYPE("nSecs") == "C" && Time string
>      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)))
>   ELSE
>*** Suppose here You passed DateTime parameters
>      nLocSecs = nSec2 - nSecs
>   ENDIF
>
>   c_znak  = IIF(nLocSecs < 0, "-","")
>   nSecs   = ABS(nLocSecs)
>   c_hours = INT(nLocSecs/3600)
>   nLocSecs= nLocSecs - (c_hours*3600)
>   c_hours = IIF(c_hours<10,"0","")+ALLTRIM(STR(c_hours,15))
>   c_min   = INT(nLocSecs/60)
>   nLocSecs= nLocSecs - (c_min*60)
>   c_min   = IIF(c_min<10,"0","") + ALLTRIM(STR(c_min,15))
>   nLocSecs= IIF(nLocSecs<10,"0","") + ALLTRIM(STR(nLocSecs,10))
>
>RETURN c_znak+c_hours+":"+c_min+":"+nLocSecs
>
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform