Format Full text date in SSRS 2008
Greetings,
I have an SSRS 2008 report with a From and To date parameters. I need the parameters to display as "March 31st, 2011" instead of "03/31/11".
Is there a way to format this, with either the =format or =formatdatetime? =formatdatetime(now(),1) will partly work, however it also displays the day, however I just need the month, day, and year in full text.
Thanks!
March 31st, 2011 3:17pm
Hi Barron,
try the below format
=Format(Fields!StartDate.Value,
"MMMM dd,yyyy")
I hope that's what you are trying to pass as a parameter.
All the bestDasari
Free Windows Admin Tool Kit Click here and download it now
March 31st, 2011 6:36pm
Since you have formatted the date with ordinal format (like 1st, 2nd etc), I guess you have to use the custom function to return the date. Please try the below,
1. Go to the report's code windows (Report Menu-->Properties. Then click on code tab) and paste the below code in it
Public Function GetOrdinal(num As Integer) As String
Select Case num Mod 100
Case 11, 12, 13
Return num.ToString() & "th"
End Select
Select Case num Mod 10
Case 1
Return num.ToString() & "st"
Case 2
Return num.ToString() & "nd"
Case 3
Return num.ToString() & "rd"
Case Else
Return num.ToString() & "th"
End Select
End Function
2. Write your date formatting expression as below
=format(Parameters!FromDate.Value,"MMMM") & " " & Code.GetOrdinal(Day(Parameters!FromDate.Value)) & ", " & Year(Parameters!FromDate.Value)
Note : Replace the FromDate with the parameter name you given for the from date. You can, in same fashion, write the expression for To Date as well.
Hope this helps.
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
BH
April 1st, 2011 12:00am