• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 811
  • Last Modified:

Is there a way to format the date parameter in Report Viewer so that it won't include the time?

I have a sales report that prompts for date. I want it to pull data based on user's specified date *only*. What happens is I get results of a specific date and time NOT all sales on one day.

I thought the solution would be to format the date parameter to MM/dd/yyyy
Is this possible? If so, please show me how.

  • 2
2 Solutions
Select Convert(datetime, Convert(Nvarchar, datefield,102), 102)
You can use this SQL to strip off the time portion

i.e. SELECT * FROM Sales
         WHERE CONVERT(varchar,CONVERT(varchar,SalesDate,103),103)
                  = CONVERT(varchar,CONVERT(varchar,@ParamDate,103),103)

This will only compare on the date, not the date and time
to get the format you require you can change the formating number 102 to 110 for usa date
see http://msdn2.microsoft.com/en-us/library/ms187928.aspx for a list of conversion formating
JaimeJegoniaAuthor Commented:
Thank you for the prompt response guys!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now