如何在 SSRS 报告中获取当月的开始和结束日期
How to get Current Month's Starting and End dates in SSRS report
我正在处理 SSRS 报告,我使用了 2 个日期选择日历,
From Date 和 To date,所以在 From Date 中,Current months 起始日期应该是默认日期,而到 to date 中,默认是当月的 Last date。
我应该使用表达式吗?或者通过SQL查询?
2012以上版本使用T-SQL很简单,使用DateFromParts
to get the first day of the month and EOMonth
得到最后一天:
DECLARE @Today Date = GETDATE();
DECLARE @FirstDayOfTheMonth date = DATEFROMPARTS(YEAR(@Today), MONTH(@Today), 1),
@LastDayOfTheMonth date = EOMONTH(@Today);
我正在处理 SSRS 报告,我使用了 2 个日期选择日历, From Date 和 To date,所以在 From Date 中,Current months 起始日期应该是默认日期,而到 to date 中,默认是当月的 Last date。 我应该使用表达式吗?或者通过SQL查询?
2012以上版本使用T-SQL很简单,使用DateFromParts
to get the first day of the month and EOMonth
得到最后一天:
DECLARE @Today Date = GETDATE();
DECLARE @FirstDayOfTheMonth date = DATEFROMPARTS(YEAR(@Today), MONTH(@Today), 1),
@LastDayOfTheMonth date = EOMONTH(@Today);