Time difference in hh.mm

  • Thanks a ton Scott...

    Missed pasting the complete code...

    Below is the complete code

    update Attendance

    set workedhours =

    --convert(decimal(10,2),REPLACE(CONVERT(char(5),es_sign_out - es_sign_in,8),':','.'))

    convert(decimal(10,2),(rtrim(convert(char(5),datediff(ss,sign_in,sign_out) / 3600 )) + '.' +

    rtrim(convert(char(5),(datediff(ss,sign_in,sign_out) % 3600) / 60)) ))

    The answer for your question is "I wanted to find the difference (between signout & signin) to be expressed in hh.mm" (in its simple form I could express).

    Please find the below data (how hard people are working).

    EmpNo AttendanceDate SignInTime SignoutTime WrkdHrs

    12102009-04-02 00:00:00.0002009-04-02 09:23:00.0002009-04-03 20:18:00.00034.55

    12102009-04-03 00:00:00.0002009-04-03 08:35:00.0002009-04-03 20:18:00.00011.43

    12102009-04-06 00:00:00.0002009-04-06 09:09:00.0002009-04-06 21:49:00.00012.40

    12102009-04-07 00:00:00.0002009-04-07 08:55:00.0002009-04-07 21:35:00.00012.40

    Now did I make my things clear on the requirement?


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

  • So, Arunkumar ... does that mean you actually have an answer to your problem or are you just posting another bit of problem code.

    I know that you think what you asked was clear but it obviously wasn't clear at all especially since you used a non-standard notation for hours and minutes. Before you post another problem, I suggest you study the first link in my signature below. This thread would have only been two posts long if you had followed those simple rules for posting data and results expected. The method even makes up for huge "language barrier" problems.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply