operations with time

  • Does anyone know how add or sub time data types.

    I have to count how long an employee has been at work that day. He/she can leave or be back at work several times per day.

    Thanks

    Mihael

  • Take a look at DateDiff and DateAdd in TSQL help.

    Andy

  • dateadd, datediff could help you for add / sub datetime fields and also datepart could be useful for you for date manipulations

    Paras Shah

    Evision Technologies

    Mumbai, India


    Paras Shah
    Evision Technologies
    Mumbai, India

  • quote:


    Does anyone know how add or sub time data types.

    I have to count how long an employee has been at work that day. He/she can leave or be back at work several times per day.

    Thanks

    Mihael


    try this

    select TimeInOffice=datediff(s, TimeIn, TimeOut) to get the values in seconds. If you create a denormalized field in your table, you can store this value when you set TimeOut. Then you can sum the TimeinOffice columns to get the total time for any period.

Viewing 4 posts - 1 through 3 (of 3 total)

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