Date Format Defaults to Server's Local Language/Culture - Can be Changed
This is another little quickie, but a useful one if you're in a position that I find myself in way too often.
I'm developing an ASP.net website for an English-speaking audience, but the site is hosted in a non-English-speaking nation. In this case, China.
The server's regional settings are set to China, so, of course, it interprets dates in the local language. I'm trying to display the short-form, three-letter month names such as "Jan, Feb, Mar" and so on. The problem is, the months are showing up in Chinese. Here's what it looks like compared with what I want:

The solution is quite simple. If you want the settings to apply globally, add the following line to your Web.Config file:
<globalization culture="en-uS"></globalization>If you'd rather set a single page, add this to the @Page directive (the line up at the top of your aspx file).
<%@ Page Culture="en-US" %>
While I'm American-English-centric, you might want to trade "en-US" for the language of your choice.
Here's a full list of culture abbreviations. My two favorites are kok-IN (mostly because I have a juvenile sense of humor and pa-IN (because culture="pain" is some interesting social philosophy).






0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home