NewbieDeveloper
NewbieDeveloper

Reputation: 15

How to configure parameter dates in SSRS

I have an SSRS report where in i have two parameters @startdate and @endDAte, my problem is for example i want to pull data dated 10/21/2013, i should input 10/21/2013 as start date and 10/22/2013 as end date because if i input 10/21 for both start and end date it will not return 10/21. I believe its interpreting the input parameter start date and enddate 10/21/2013 00:00:00, i want to pass an end date like 10/21/2013 59:59.999 so to pull all 10/21/2013 data. I already used functions to convert enddate to this format and ive tried to set defaultvalues to mm/dd/yyy + " 23:59:59" but its not working. Please help. Thanks

Upvotes: 1

Views: 9628

Answers (1)

Ian Preston
Ian Preston

Reputation: 39566

You should be able to time components to default values for dates.

e.g. To set the default to the end of today, use the default expression as:

=CDate(Format(Today(), "yyyy-MM-dd" & " 23:59:59"))

enter image description here

Note the Format string is using MM (i.e. months) and not mm (i.e. minutes).

However, I think you'd be better served by the approach suggested in your previous question, i.e. something like this in the T-SQL behind the report:

AND MyDate < DATEADD(DAY, 1, @EndDate)

This seems more clean and intuitive than trying to add certain time components to a date the user selects - what if they override the default and remove the time part?

Upvotes: 2

Related Questions