Problem with reversing date / month with saving

We have a problem that only affects the production environment.

We have a VB6 / ASP website that allows you to edit data in a database table manually.

It looks like an editable datagrid.

One of the editable columns is the date and when the entry is saved, the day / month dates are reversed.

03/11/2008 becomes 11/03/2008, if you should have saved the date, the date will be 03/11/2008 again.

I checked the DB value and it does reverse, however the same identical code in test systems does not.

So I'm pretty sure I'm looking for a change in the environment. The test system has a DB and a site hosted locally, and in real time we have a separate website server and a database server. Where you suggest I start looking for this problem. I have checked the regional settings on the servers and they are set to United Kingdom and the OS date format is correct.

This is SQL Server 2000. Hit me with some ideas !.

Thank:)

0


source to share


5 answers


If you convert a user-supplied string to a date before you post it to the DB, then the thread execution Session.LCID your ASP page is responsible for how dates are interpreted.

If you feed the date as a string to SQL Server and allow the conversion there, you might find it helpful to look at SET DATEFORMAT

and SET LANGUAGE

.



So here's my idea: Either stop using (encourage users to use) ambiguous date formats and this problem goes away, or make sure everyone in the processing chain has a clear idea of ​​what format to expect.

+1


source


This is almost certainly due to the fact that your computer or db server is set to US date format. Double check your system settings.



Alternatively, a quick Google search will open up several options for managing your data so it does what you want it to do.

+1


source


How about OS regional settings?

0


source


The following

select name, alias, dateformat from syslanguages ​​where langid = (select value from master..sysconfigures where comment = 'default language')

Returns the same result in test and live

us_english English mdy

The problem is that the system cannot be redistributed for change. I need to determine the cause and fix it.

0


source


Go to regedit and navigate to the following location in the Windows Registry:

HKEY_USERS.DEFAULT \ Control Panel \ International \

Make sure the "sShortDate" field is correct.

The format for the short dates stored in this location differs many times from the format for the short dates stored in the Windows Control Panel / Regional Options. The short time date in the regional settings is for the user that you are logged into Windows as. The sShortDate field in HKEY_USERS in the short date format used by Windows Services.

0


source







All Articles