I am working on SSRS Report, I have used 2 Date selection calendar, From Date and To date, So in From Date the Current months starting date should be as default date, and into the to date the Last date of the current month should be by default. Should I use Expression? or By SQL Query?
Using T-SQL for 2012 version or higher it's quite simple, using DateFromParts
to get the first day of the month and EOMonth
to get the last day:
DECLARE @Today Date = GETDATE();
DECLARE @FirstDayOfTheMonth date = DATEFROMPARTS(YEAR(@Today), MONTH(@Today), 1),
@LastDayOfTheMonth date = EOMONTH(@Today);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.