How to do we achieve date format in SSRS.
- Using inbuilt format method to achieve date format in SSRS.
Using above format method to achieving 21.10.2016 date.
If you want to date format like 21st October 2016 then there is no inbuilt method support to SSRS.
So for the need to write a custom code on the report (.rdl file).
Right click and goto report property and select code section and write to following code.
Call above function =Code.ConvertDate(Parameter!ReportingDate.Value), will get the output result as a date format 21st October 2016.
Reference link - https://stackoverflow.com/questions/32712572/format-datetime-day-with-st-nd-rd-th
- Using inbuilt format method to achieve date format in SSRS.
=format(cdate(Parameter!ReportingDate.Value),"dd.MM.yyyy")
Using above format method to achieving 21.10.2016 date.
If you want to date format like 21st October 2016 then there is no inbuilt method support to SSRS.
So for the need to write a custom code on the report (.rdl file).
Right click and goto report property and select code section and write to following code.
Public Function ConvertDate(ByVal mydate As DateTime) as string Dim myday as integer Dim strsuff As String Dim mynewdate As String 'Default to th strsuff = "th" myday = DatePart("d", mydate) If myday = 1 Or myday = 21 Or myday = 31 Then strsuff = "st" If myday = 2 Or myday = 22 Then strsuff = "nd" If myday = 3 Or myday = 23 Then strsuff = "rd" mynewdate = CStr(DatePart("d", mydate)) + strsuff + " " + CStr(MonthName(DatePart("m", mydate))) + " " + CStr(DatePart("yyyy", mydate)) return mynewdate End function
Call above function =Code.ConvertDate(Parameter!ReportingDate.Value), will get the output result as a date format 21st October 2016.
Reference link - https://stackoverflow.com/questions/32712572/format-datetime-day-with-st-nd-rd-th
0 comments:
Post a Comment