Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DateFormat and Culture
Message
De
09/03/2016 11:44:58
 
 
À
09/03/2016 10:01:18
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01632723
Message ID:
01632753
Vues:
48
Thanks Rob.

Interesting thing is when I implement Rick's code, I get the culture as "en-us" so the dates get set to mm/dd/yyyy. Where does it get this setting from? I have my Format set to English (Trinidad and Tobago) under the Region applet in Windows. Where do I set the culture?

later

I found this setting is in the Region applet under the Administrative tab where it says "Language for non-unicode programs". If I change the settings there to English (Trinidad and Tobago) then the display will work as I expect (at least so far in my testing, but I wouldn't bet my life on it).

As this does not seem like the setting I am really looking for maybe this code isn't what I should be using. Is there any way to pull the Short Date format from the Formats tab?

>You may need to get it from Request.UserLanguages instead of CultureInfo.CurrentCulture. See https://weblog.west-wind.com/posts/2014/Mar/27/Auto-Selecting-Cultures-for-Localization-in-ASPNET for a complete method.
>
>>Thanks Craig,
>>
>>I am not seeing how to "translate" that article to my specific problem. That seems to convert the display of a date in a textbox to whatever is the current culture's date display format.
>>
>>Shouldn't the code I used below have worked?
>>
>>
>>>http://www.codeproject.com/Articles/3612/Use-of-different-Date-Time-formats-and-Culture-typ
>>>
>>>
>>>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform