I have a stored procedure to generate report using the SQL Server Reporting Services. Stored Procedure returns results and has one date column.
Now i would like to display the date in Aug 5 20开发者_如何学编程09, 11:20:AM format instead of showing MM/DD/YYYY so i have cast the date as follows in select query inside the Stored Procedure [select col1, col2, cast(datecol as varchar(max) ...)]. This has helped me get the date displayed in correct format i wanted but the columns are getting sort as per text(A-Z) instead of the date.
Can someone tell me what should i do so that i am able to get the date in expected format and still be able to sort the column like its Date not String?
Send the data as a date, and use reporting services Format
method to change the way it is displayed.
See this thread for description of the parameters to use
So you'll end up using something like this expression:
=Format(Fields!MyDateField,"MMM d yyyy, HH:mm tt")
=CDate(Fields!MyDateField.Value)
The value returned in your report are a "String", CDate converts this string value to a Date type. Doing that possible the sort by this column as Date type correctly.
精彩评论