Adding date and interger values

  • I'm trying to make a field called "maturity date" which gives the date that a contract my company has written will be fully matured. The way to calculate this is to add the number of terms(months) to the first payment date. Is it possible to add say 24 months to the month field of the first payment date?

  • Look up DATEADD function in BOL (Books Online)

    DECLARE @PayDate datetime

    SET

    @PayDate = '2007-01-01'

    SELECT

    DATEADD(MONTH, 24,@PayDate)

  • Using the MSDN article, that doesnt seem to be working. Check out my expression:

    =DateAdd (Month, Fields!CONTRACT_TERM.Value, Fields!FIRST_PAY_DATE.Value)

    Do you see anything I could be doing wrong?

  • Russel

     

    I used example from sqljunkie myself and it works just fine

     

    Is yr dateformet set wel ?

    Use the set dateformat function otherwise, e.g.  set dateformat mdy before yr statement.

    Good luck


    JV

  • I ended up having to add something else to it. This is how it worked for me.

    =DateAdd (DateInterval.Month, Fields!CONTRACT_TERM.Value, Fields!FIRST_PAY_DATE.Value)

    That expression adds the number of months contained in CONTRACT_TERM to the date contained in FIRST_PAY_DATE. Thanks for your help guys!

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

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