我正在使用Visual Studio 2012和SQL Server 2012。
我创建了两个参数,StartDate和EndDate,它们都是日期/时间参数。
在我的EndDate参数中,我已将默认值设置为Today()以获取今天的日期。
对于我的StartDate参数,我希望它以以下方式基于EndDate参数。 无论用户选择什么日期作为结束日期,StartDate将是24个月/ 2年前的日期。 (例如,如果EndDate是今天(2017年1月11日)......那么StartDate将是2015年1月11日。)
在表达式框中,这是我到目前为止我的StartDate默认值。 =DateAdd(DateInterval.Year,-2,Today())
我如何获得它,以便每次更改EndDate时,StartDate相应地更新为2年前?
I am using Visual Studio 2012 and SQL Server 2012.
I have created two parameters, StartDate and EndDate, which are both Date/Time parameters.
In my EndDate parameter, I have set the Default Value to Today() in order to get today's date.
For my StartDate parameter, I want it to be based off the EndDate parameter in the following way. Whatever date the user selects as End Date, StartDate will be the date 24 months/2 years prior. (For example, if EndDate was Today (1/11/2017)...then StartDate would be 1/11/2015.)
In the expressions box, this is what I have so far for my default value for StartDate. =DateAdd(DateInterval.Year,-2,Today())
How do I get it, so that every time I change the EndDate, the StartDate updates accordingly to be 2 years prior?
最满意答案
试试这个表达式它将在2015年1月22日返回
=Date.Now.Date.AddYears(-2).AddDays(10)Try this expression it will return 1/22/2015
=Date.Now.Date.AddYears(-2).AddDays(10)更多推荐
发布评论