Subtarcting seconds from a time

  • Hi,

    I have a computed column with this in it:

    (case when [Duration]<'00:52' then '00:00' else [Duration] end)

    The column Duration is a Time(4) datatype. I need to subtract 52 seconds from it.

    For example, one record has 00:01:16.0000, which is 1 minute and 16 seconds, or 60+16 which is 76 seconds.

    The problem is that I need to be able to subtract 52 from this and if it is less than zero that is is zero otherwise it is the time in the duration column.

    Thank you

  • DATEDIFF with a CASE statement should do it.

  • Sorry, I am not sure how I would use DATEDIFF  here, because that needs two dates I think.

    Thank you

  • Thank you

    I git this to work

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

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