Reputation: 132
I have created a report in RDLC (using Visual Studio 2013). in which I have a date field. I wanted to display the date field as 01-Jan-2015. Hence I have formatted the date field using Format(Fields!LICDate.Value,"dd-MMM-yyyy")
.
However, I get a varied output in the date field. For some date the date is formatted correctly, for example the records having the date as 28th November 2015 are displayed as 28-Nov-2015, but some records this displays weird characters. Like, if the date is 1st October 2018, it shows 01-OcA-2018, for 1st March 2016, it shows 01-3ar-2016
I have browsed through web and got various links that show examples of date formatting in RDLC and almost all the links suggest using of Format
and some links have suggested using .ToString("dd-MMM-yyyy")
. I tried both the suggestions but the result is the same.
Am at loss on what has actually happened. The data in the database records is correct and whn I display int he DataGridView it shows correctly. This problem occurs in RDLC reports only that too for a few records only.
Any suggestions or links to solutions for similar problems are welcome.
Upvotes: 1
Views: 249
Reputation: 2830
Instead of using Format, try to right click on that text box and go to Properties/Number, then select Custom from Category and in Custom Format enter dd-MMM-yyyy. This should fix your problem.
Here is link that can help you: VS report designer 2005-date format with MMM
Upvotes: 0