Clarificaiton on Date/Time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemashiki
    New Member
    • Aug 2006
    • 34

    Clarificaiton on Date/Time

    i have two textboxes one contains the intime(which in AM) and another contains the outtime(which is in PM).hence the worked hours must be the difference between the two (outtime and intime)

    for eg:

    intime=9:00AM
    outtime=5.00PM

    then the worked hours must be( 8 )
    but the result i got is -4

    can any one suggest plz :p
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    use the below attached code segment for calculating time difference in vb, good luck and take care my fren.. :)

    Code:
    Dim time1 As Date, time2 As Date, interval As Long  
      
    time1 = Format(Now, "HH:mm:ss")  
      
    time2 = Format(Now, "HH:mm:ss")  
      
    interval = DateDiff("s", time1, time2)  
      
    MsgBox "The MessageBox was displayed from " & time1 & " until " & time2 & ".  
      
    an elapsed time of " & interval & " seconds."

    Comment

    • hemashiki
      New Member
      • Aug 2006
      • 34

      #3
      hi
      thanks for ur code.......
      take care :cool: friend

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Hi Hemashiki,

        Anytime my fren.. hope to see more questions from you in the future :)
        u take care too..

        Comment

        • hemashiki
          New Member
          • Aug 2006
          • 34

          #5
          Hi sashi....
          i have one query....in data grid
          how to clear the data grid while loading the form.

          i have used datagrid1.clear ,but its not working
          can u suggest me............. ............... .......
          take care friend :p

          Comment

          Working...