This has got me really flumoxed!
- In the datalayer ADO.NET connects to SQL Server 2008, Default language for the login is 'british'
- Selects a DateTime column into a dataview and returns it.
- aspx page databinds
- this: <%# String.Format("{0:MMM/yyyy}", Eval("dbPeriodFrom")) %>
The database returns 2009/10/01 (This is yyyy/MM/dd) The result of step 4 is Jan2009 ????
The regional settings of the web server is United Kingdom There is no <globalization... section in machine.config The NET globalisation in IIS is set to uiCulture=en culture=en-GB I even set it in the web.config for the site
This is a classic "Works on my dev machine.." But, borked when deployed to production scenario. What could I possibly have missed?
EDIT
So it appears the login used by the ASP.NET Application to connect to SQl Server 2008 is getting a US datetime, even though in the properties for the login, the default language is set to 'British English'.
The problem occurs in TSQL:
SELECT
DATEPART(month, CAST('2009.02.01' AS DATETIME))
,DATEPART(month, CONVERT(DATETIME, '2009.02.01', 102))
OUTPUT for windows integrated login (Administrator) with default language set to 'English'
2 2
OUTPUT for SQL Server login used by ASP.NET with default language set to 'British English'
1 2