views:

62

answers:

1

I need to solve the following problem for one of my clients. They have an installer which installs a SQL server database + IIS website.

The SQL database user can have any kind of date format (DD/MM/YYYY, MM/DD/YYYY,...) depending on the locale of the sql server. The IIS website can have any kind of date format (can be different from sql server). The user browsing to the website can have any kind of date format (date formats from all over the world).

I'm struggling to find a solution for the following: (asp.net) 1) an end-user using his browser must be able to enter and validate a date in it's own date format 2) the date must be written to the sql server in the date format of the sql server which can be different.

Hints are welcome.

+1  A: 

For ASP.NET, I assume that you're using the Culture and UICulture to set date and time formatting to the user's preference. I haven't worked with ASP.NET's validator controls in a specific (non-US) culture, but I would be surprised if they don't honor the current culture as well.

The SQL Server answer is relatively easy: You have a .NET DateTime value in your code. Pass that to SQL Server as a parameter, rather than formatting it into an SQL statement.

Cylon Cat