This has got me really flumoxed!
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
Check the locale setting on the database itself and on their server, depending on the set up, the date will be formatted accordingly to the locale setting. I suspect the database server is probably set up to US English - Poke around in the regional settings on the db server itself.
Hope this helps, Best regards, Tom.