0

I am setting the locale of my .net application via:

 string userLocale = Web.Helpers.LocaleHelpers.GetBestRFC3066Locale(this.Context.Request.UserLanguages);

            if (userLocale != String.Empty)
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(userLocale);
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(userLocale);
            }

This works well, so my dates will be displayed in the format based upon the locale i.e.

12/10/2009 for en-gb and 10/12/2009 for us

However when I persist my dates via LinqToSql I need to store these dates in a common format.

Currently when a U.S. user is running the app the date stored in the DB is in U.S. format and when an U.K. user uses the app, its in a U.K. format.

Any suggestions on how best to achieve this?

2 Answers 2

2

Store the date as a datetime value in SQL Server. Then you don't run into a conversion problem.

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

Comments

0

Brannon has the right solution there. Once you have a variable in a datetime format in SQL you can convert it to other datetime formats using the CONVERT T-SQL keyword

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.