I want to display dates and currency amounts in my users chosen format.
How can I retrive this from the client machine?
Alternatively, is there some other way to format dates/currency correctly?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A browser exposes it’s locale: You can retrieve it by using
** Thread.CurrentThread.CurrentUICulture**read more about this here and here
You can overwrite their Culture with a culture of your chosing (if the select another language from a menu perhaps)
to format the date time, and string read here
Watch out, setting a culture happens very soon in a page cycle, if you set it to late, the resource files will be those of a previous selected Culture.
To set the Culture early in the cycle you can create a basepage (that inherits ViewPage){}
page
here is the full example, but I copied the code for easyness: example
another approach is using the global asax which can be found here