title: Date calculation with parameter in SSIS is not giving the correct result
body: <p>I want to load data from the last n days from a data source. To do this, I have a project parameter "number_of_days". I use the parameter in an OleDB data source with a SQL Command, with a clause </p>
  
  <pre><code>WHERE StartDate &gt;= CAST(GETDATE() -? as date) 
  </code></pre>
  
  <p>This parameter is mapped to a project parameter, an Int32. But, if I want to load the last 10 days, it is only giving me the last 8 days.</p>
  
  <p>Version info: </p>
  
  <ul>
  <li>SQL Server Data Tools   15.1.61710.120</li>
  <li>Server is SQL Server 2017 standard edition.</li>
  </ul>
  
  <p>I set up a test package, with as little data as possible. There is this data source:</p>
  
  <p><img src="https://imgur.com/1RzbWHt.png" alt="data source"></p>
  
  <p>Parameter:</p>
  
  <p><img src="https://imgur.com/zwoZpuk.png" alt="parameter"></p>
  
  <p>Parameter mapping:</p>
  
  <p><img src="https://imgur.com/GCriThm.png" alt="parameter mapping"></p>
  
  <p>The T-SQL expression (wrong result):</p>
  
  <pre><code>CAST(GETDATE() -? as date)
  </code></pre>
  
  <p>The SSIS expression for date_calc (correct result):</p>
  
  <pre><code>(DT_DBTIMESTAMP) (DT_DBDATE) DATEADD("DD", - @[$Project::number_of_days]  , GETDATE())
  </code></pre>
  
  <p>I would think that the T-SQL expression and the SSIS expression give the same result (today minus 10 days) but that is not the case when I run the package and store the results in a table. See column date_diff, which gives 8 days instead of 10:</p>
  
  <p><img src="https://imgur.com/blp7Y4u.png" alt="result"></p>
  
  <p>If I replace the parameter by the actual value, I do get the correct result.</p>
  
  <p>A data viewer also shows the incorrect date. When I deploy the package, I get the same result as from the debugger.</p>
  
  <p>Is this a bug, or am I missing something here?</p>