Add days and Date Calculation

Larisa Gasparian

Hello,

I want to add 140 to current date. For example 04/23/21 if I add 140 days, my variable result is 2021/05/63. Any ideas why?

IF (@STORE2 = '02' AND @STORE11 = 'N' AND @STORE4 = 'N' AND @STORE20 = 1) BEGIN

IF (@STORE5 < $[$10.0.0] + 140 + @STORE3)

BEGIN @STORE5 = $[$10.0.0] + 140 + @STORE3;

END

END

@STORE5 is 04/23/21.

Thank you  

Comments

2 comments

  • Comment author
    Dave Gutman

    Hi Larisa, 

    This can be done using the SQL helper, which allows you to create a SELECT statement that returns the date in the desired format.  The online help has a few examples of using SELECT to handle data math in section on the SET() command.  You'll have to adjust the syntax a bit to assign the results to the @STORExx variable.  

    Hope this helps.

    0
  • Comment author
    Larisa Gasparian

    Thank you, I'll try that 

    0

Please sign in to leave a comment.