I am moving a classic asp website from a windows 2k3 server/iis6 environment to windows 2008r2/iis7. A couple of the pages pass the system date to an mssql database and the following error is occuring: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The date being passed is ’13/01/2011 hh:mm:ss AM’. I understand that the database is interpretting this as the 13th month and that is why the error.
What I don’t understand is where exactly this date is coming from. The page is using this snippet for the date:
FormatDateTime(DATE() & " " & Time(), vbGeneralDate)
This should return a date in the format mm/dd/yyyy but it doesn’t seem to. Since web servers are using the same database I figure the problem must be web server specific.
I checked in control panel/regional settings and both are set to US english and the format there appears to be correct. Is the system date & time formats specified anywhere else? I could not find anything in IIS where I could set a default date format
The problem ended up being the system locale setting found in control panel –> region and language. This setting “controls the language used when displaying text in programs that do not support Unicode.”