I'm working with certifications and I need to append date of the day suffixes. I tried using =Day(Fields!Date.value)
in the expression property of the TextBox but the output is just a number/date of the day but has no suffix. I have no problem in Month and Year only the suffixes in the date of the day. Thanks
Asked
Active
Viewed 2,345 times
0

haraman
- 2,744
- 2
- 27
- 50

roger bulawan
- 167
- 1
- 1
- 11
2 Answers
1
Using the suggestion in Is there an easy way to create ordinals in C#? you can create a Custom Code
for your rdlc report and use it with the expression.
In the rdlc properties add the following function in Code tab
Public Shared Function AddOrdinal(num As Integer) As String If num <= 0 Then Return num.ToString() End If Select Case num Mod 100 Case 11, 12, 13 Return num & "th" End Select Select Case num Mod 10 Case 1 Return num & "st" Case 2 Return num & "nd" Case 3 Return num & "rd" Case Else Return num & "th" End Select End Function
Then modify your Expression as follows
=Code.AddOrdinal(Day(Fields!Date.value))
-
1Thank you! You saved my life! Oh God you're so great! – roger bulawan Nov 12 '15 at 01:31
0
If you can modify your data set you could add the following fields to split the date into a day, suffix and Month / Year:
select Cast(DAY(Date) as Varchar(2)) as MthDay, DATENAME(month, Date) + ' ' + convert(varchar(4),year(Date)) as MthYr,
CASE WHEN DAY(Date) in (1,21,31) THEN 'st' WHEN DAY(Date) IN (2,22) then 'nd' WHEN DAY(Date) IN (3,23) then 'rd' ELSE 'th ' end as Suffix
From MyData
You could then use three text fields in your report to display the date with the suffix text being set to say 6pt and set to display at the top of the field.
Alternatively you could use one text field set to allow HTML tags and join the the three parts together using the sup tag to display the suffix appropriately.

Ewan
- 1,067
- 8
- 15