how we calculalte the time from a database column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    how we calculalte the time from a database column

    Hi
    i have two columns in database i,e "operator id" and "data and time"
    my probleum is how can i calculate the total time spent by a particular operator while working .
    i mean to say when the operator is entering the records at the same time its start time and end time with date is inserted into the "date and time column"
    and i want to calculate only the time from that column for a particular operator

    if you need some other information please ask me

    is there any method of doing this
    pleaseeeeeeeeee e help
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Originally posted by veer
    Hi
    i have two columns in database i,e "operator id" and "data and time"
    my probleum is how can i calculate the total time spent by a particular operator while working .
    i mean to say when the operator is entering the records at the same time its start time and end time with date is inserted into the "date and time column"
    and i want to calculate only the time from that column for a particular operator

    if you need some other information please ask me

    is there any method of doing this
    pleaseeeeeeeeee e help
    Avoid using spaces in naming your fields. Can you show us what have you done so far?

    Rey Sean

    Comment

    • veer
      New Member
      • Jul 2007
      • 198

      #3
      i did nothing beacuse i am not getting any idea i just show you how my database looks

      Yp1EOp--------- Yp1EStartTime
      153---------------- 4/15/2008 2:39:15 PM
      153---------------- 4/15/2008 2:42:31 PM
      153 --------------- 4/15/2008 2:42:59 PM
      153 --------------- 4/15/2008 2:43:12 PM
      153 --------------- 4/15/2008 2:43:24 PM
      153 --------------- 4/15/2008 2:43:32 PM
      these are few rows of my database
      and i want to calculate the time from column "Yp1EStartT ime"
      please check and tell is it possible to calculate the total time spent from this column. e.g for first two rows the time will be
      row2 - row1 = 3 minutes and 16 second


      Originally posted by lotus18
      Avoid using spaces in naming your fields. Can you show us what have you done so far?

      Rey Sean

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        OK, if i got uoir point, you want to get the total time by subtracting the last time and the first time.

        Comment

        • lotus18
          Contributor
          • Nov 2007
          • 865

          #5
          OK, if i got uoir point, you want to get the total time by subtracting the last time and the first time with the same date and operator?

          Rey Sean
          Last edited by lotus18; Apr 26 '08, 08:06 AM. Reason: replaced uoir with your

          Comment

          • lotus18
            Contributor
            • Nov 2007
            • 865

            #6
            Sorry for the double-posting I tried to delete but i cannot see the delete button lol. You can try the DateDiff function and using Where clause from your SQL statement.

            Rey Sean

            Comment

            • CyberSoftHari
              Recognized Expert Contributor
              • Sep 2007
              • 488

              #7
              Originally posted by veer
              i did nothing beacuse i am not getting any idea i just show you how my database looks
              Yp1EOp--------- Yp1EStartTime
              153---------------- 4/15/2008 2:39:15 PM
              ...
              If there is a start Time field in a database then, there should available of End time field. Check your database design.

              Comment

              • veer
                New Member
                • Jul 2007
                • 198

                #8
                Hi
                i use Datediff() and it return only hours but i want total time with minutes and seconds at the same time
                i use following code for all this and it works fine but when the the time came which i have mentioned in the coding produces wrong output
                because the difference between is 1:13:52 but it is showing 12:33:52
                how can i correct this please help


                Dim Start As Date
                Dim Finish As Date
                Dim Duration As Date
                Dim outStr As String
                Dim Length As Integer

                'Converting time values to dates
                Start = CDate("5:53:05 PM")
                Finish = CDate("6:26:57 PM")

                'Find duration
                Duration = Finish - Start
                outStr = CStr(Duration)

                'Convert to string an trim AM/PM indicator
                Length = InStr(outStr, "AM")
                outStr = Mid(CStr(Durati on), 1, Length - 2)
                MsgBox (outStr)

                Originally posted by lotus18
                Sorry for the double-posting I tried to delete but i cannot see the delete button lol. You can try the DateDiff function and using Where clause from your SQL statement.

                Rey Sean

                Comment

                Working...