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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.