I just want to understand this concept and implement it into my application. Since, suppose I have deployed my asp.net mvc web application at US server. and If I am showing the datetime on my one of the page, say in grid control. and consider somebody accessing site from the UK or India Or Gulf then the date time format should be change accordingly. Also the datetime input controls should be behave accordingly. What concept i need to use for this?
Asked
Active
Viewed 371 times
2
-
2timezone is not a good variant, because in one timezone can be countries with different date formats. The best choise, use the user language from request. – alexmac Jan 17 '14 at 11:17
-
http://msdn.microsoft.com/en-us/library/system.web.httprequest.userlanguages(v=vs.110).aspx should solve your problem. – Zinoex Jan 17 '14 at 11:20
1 Answers
0
You need to understand where request came from. You can analyze timezone(example Getting the client's timezone in JavaScript), user language or check client ip adress. After that you can use correctly formated date string.
Edit:
interesting topic from msdn: http://msdn.microsoft.com/en-us/library/bz9tc508%28v=vs.90%29.aspx
-
-
-
-
@ Alexander, i think that Thread.CurrentUICulture contains server culture settings. But may be parameter enableClientBasedCulture in web.config change this situation. – Frank59 Jan 17 '14 at 12:10
-
1@Frank59, Thread.CurrentUICulture contains culture for the current user context. For the asp.net web application this context initialized from request header params. And yes, enableClientBasedCulture can change this behavoir. – alexmac Jan 17 '14 at 12:23
-