Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DateFormat and Culture
Message
De
10/03/2016 06:43:38
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01632723
Message ID:
01632780
Vues:
53
Thanks Rick, someone had pointed out your blog and I had gone through it already. Your code seems to pull the settings from the System Locale rather than the Regional short date format. SO for instance I could have my region set to Trinidad and Tobago which uses dd/mm/yyyy as the short date format, but the System locale could be set to "en-us" (I was completely unaware of this setting until I used your code). I don't think many people are aware of that. Or maybe I am just seeing weird results.

I do like your idea of displaying the month in words to get rid of all ambiguity.

>You can sniff the browser's languages and based on that automatically switch that local. Best to do this in Application_BeginRequest of each request.
>
>You'll probably want to be careful not to actually support all languages for translation (UICulture), but you might want to support all the culture information (Culture) for date and number formats.
>
>You can also override specific settings explicitly by creating a new Culture object for a specific locale and hten overriding any values. For example, I like to override the currency symbol and set it to a $ because I only sell stuff in US dollars regardless of the user's culture. Yet I allow people to see dates and
>numbers in their culture specific formats.
>
>I have a related blog post that discusses selecting cultures and overriding some values (I typically override the currency symbol because I charge in $ regardless of locale).
>
>https://weblog.west-wind.com/posts/2014/Mar/27/Auto-Selecting-Cultures-for-Localization-in-ASPNET
>
>All that said, for dates I much prefer NOT using numbers but using things Oct 10, 2015 or things like Yesterday, last week etc. These things are usually much better at showing the values wihtout the positioning ambiguity. Something to consider.
>
>
>+++ Rick ---
>
>>Hi,
>>
>>using C# and ASP.NET for a web site. When I run the stuff locally, my dates display in dd/mm/yyyy format which is what I want. When I install it on a web server which has its date formatting set to mm/dd/yyyy the web pages display dates in mm/dd/yyyy format.
>>
>>What I would like is the dates to display in the format set on the PC that is accessing the web site. I am using DevExpress and their advice was to use this:
>>
>>
        protected void Page_Load(object sender, EventArgs e)
>>        {
>>            (ASPxGridViewMain.Columns["Timestamp"] as GridViewDataDateColumn).PropertiesDateEdit.DisplayFormatString = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
>>        }
>>
>>
>>This doesn't seem to be working.
>>
>>Any suggestions as to how to get this to work?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform