Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime formatting in SSRS ReportViewer always uses en-US?

I'm having a show-stopping issue with the ReportViewer component that's part of SSRS. I'm working on a WinForms application and have a couple of local reports that show DateTime values from the database in various locations. Regardless of how the formatting is done (no formatting at all, using "d" in the Format property, or using FormatDateTime with any of the DateFormat enumeration values), it always appears to format the DateTime with the en-US culture rather than the system date and number formatting culture.

I've validated that CurrentCulture is as expected. The report language is set to "Default". The Language tag is not even present in the .rdlc file. If I change the report language then it appears to reflect the formatting for that culture regardless of the system culture.

Is there a way either to render the report with the current system culture, or programmatically modify the language of the report based upon the culture?

like image 262
Adam Robinson Avatar asked Apr 09 '10 16:04

Adam Robinson


1 Answers

It turns out that "Default" as a Language setting doesn't do much. In order to pick up the user's current culture, Language has to be specified as the expression "=User.Language" (this also needs to be set on all subreports, as the value doesn't propagate or inherit).

Credit to Chris May in his blog article on the subject.

like image 116
Adam Robinson Avatar answered Nov 15 '22 11:11

Adam Robinson