Adding a time to a duration to give the new time

  • Hi guys

    I am currently stumped

    I have an EST field which looks like 3/3/2015 10:00 AM

    Then I have total duration field which may say 3.50

    I have used the dateadd("h",Fields!EST.Value,Fields!Total_Duration.Value)

    This returns 3/3/2015 13:00

    Moreover if EST was for example 3/4/2015 10:30 and total duration was 1.85 it returns 3/4/2015 11:30

    Hopefully someone can suggest a more expression which I can use.

    Thanks in advance.

  • Dateadd accepts integer units, so your only option is using a smaller interval such as seconds and do your math outside the function call.

    -- Gianluca Sartori

  • I other words, multiply hours * 60 and then do a DATEADD(mi, to that.

    --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)

  • Thank you for your help guys

    It works 🙂

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

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