Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to remove seconds in TIME() & subtract it.........
Message
 
À
05/08/2004 02:57:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00930059
Message ID:
00931629
Vues:
22
>hi,
>
>yes i need sample, but i want to run this function or procedure many times for many defrent textboxes at my form.(i don't know how)
>ex..
>thisform.text3.value=thisform.text2.value-thisform.text1.value
>thisform.text6.value=thisform.text5.value-thisform.text4.value
>.
>.
>.
>and how ican sum the times from mytextboxes as thisform.text10.value=thisform.text3.value+thisform.text6.value
>
>and thisform.text12.value=thisform.text10.value*$11.9.
>
>if you think or feel this is too much forget it.
>
>thank you very much.
>
>best regards

Sorry for the delay. Here's an example
**************************************************
*-- Form:         form1 (c:\program files\microsoft visual foxpro 8\seconds.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   08/08/04 11:05:07 AM
*
DEFINE CLASS form1 AS form


  Height = 153
  Width = 325
  DoCreate = .T.
  AutoCenter = .T.
  Caption = "Form1"
  Name = "Form1"


  ADD OBJECT label1 AS label WITH ;
    AutoSize = .T., ;
    Caption = "Start Time:", ;
    Height = 17, ;
    Left = 15, ;
    Top = 18, ;
    Width = 61, ;
    Name = "Label1"


  ADD OBJECT txttime1 AS txttime WITH ;
    Height = 24, ;
    Left = 79, ;
    Top = 15, ;
    Width = 72, ;
    Name = "Txttime1"


  ADD OBJECT label2 AS label WITH ;
    AutoSize = .T., ;
    Caption = "Stop Time:", ;
    Height = 17, ;
    Left = 160, ;
    Top = 19, ;
    Width = 61, ;
    Name = "Label2"


  ADD OBJECT txttime2 AS txttime WITH ;
    Height = 24, ;
    Left = 224, ;
    Top = 16, ;
    Width = 72, ;
    Name = "Txttime2"


  ADD OBJECT label3 AS label WITH ;
    AutoSize = .T., ;
    Caption = "Difference:", ;
    Height = 17, ;
    Left = 38, ;
    Top = 57, ;
    Width = 61, ;
    Name = "Label3"


  ADD OBJECT lblelapsed AS label WITH ;
    AutoSize = .T., ;
    Caption = "", ;
    Height = 17, ;
    Left = 113, ;
    Top = 57, ;
    Width = 2, ;
    Name = "lblelapsed"


  ADD OBJECT command1 AS commandbutton WITH ;
    Top = 101, ;
    Left = 116, ;
    Height = 27, ;
    Width = 72, ;
    Caption = "Close", ;
    Name = "Command1"


  PROCEDURE secondsdifference
    LPARAMETERS tcStart, tcStop

    LOCAL ltstart, ltstop
    ltstart = CTOT(DTOC(DATE()) + SPACE(1) + tcStart)
    ltstop = CTOT(DTOC(DATE()) + SPACE(1) + tcStop)
    IF ltstart > ltstop THEN 
      * Edit - This was orginally
      *  ltstart = ltstart - (24 * (60 ^ 2)) - 1
      ltstart = ltstart - (24 * (60 ^ 2))
    ENDIF 
    RETURN TRANSFORM(ltstop - ltstart)
  ENDPROC


  PROCEDURE txttime2.LostFocus
    ThisForm.lblelapsed.Caption =;
      ThisForm.Secondsdifference(ThisForm.txttime1.Value,;
      ThisForm.txttime2.Value)
  ENDPROC


  PROCEDURE command1.Click
    ThisForm.Release 
  ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************


**************************************************
*-- Class Library:  c:\program files\microsoft visual foxpro 8\time.vcx
**************************************************


**************************************************
*-- Class:        txttime (c:\program files\microsoft visual foxpro 8\time.vcx)
*-- ParentClass:  textbox
*-- BaseClass:    textbox
*-- Time Stamp:   08/08/04 09:52:00 AM
*
DEFINE CLASS txttime AS textbox


  Height = 23
  InputMask = "##:##:##"
  Width = 100
  Name = "txttime"


  PROCEDURE Valid
    LOCAL lnhours, lnminutes, lnseconds
    lnhours = VAL(LEFT(This.Value, 2))
    lnminutes = VAL(SUBSTR(This.Value, 4, 2))
    lnseconds = VAL(RIGHT(This.Value, 2))
    RETURN BETWEEN(lnhours, 0, 23) AND;
      BETWEEN(lnminutes, 0, 59) AND;
      BETWEEN(lnseconds, 0, 59)
  ENDPROC


ENDDEFINE
*
*-- EndDefine: txttime
**************************************************
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform