Sunday, 13 April 2008

SSRS and Date Formats

Bit of a geeky one this but it was annoying enough to find the answer that I thought it worthwhile to post. If you use Visual Studio 2005 to design a SQL Server Reporting Services 2005 report then VS will default the country code for the entire report to English (US). You'll find that the date picker and long/short date formats in the report all come out month first regardless of your locale.

One fix for this (if you're British) is to set the report language to English (UK). However if you're writing a product whose audience is global then that isn't good enough.

The correct solution was to set the report language to =User!Language. With this SSRS will pick up the locale from the user's web browser. It's up to the user to make sure their web browser is configured correctly, but c'est la vie.

(If you use this technique and you have any currency fields in the report then you'll need to set the language for those fields explicitly, otherwise the currency symbol will change depending on the user's browser locale... you probably want to keep the currency symbol constant).