Reputation: 55122
I have an MVC app and I need to use datetime format for Turkey. I have datitime being used all over the place. Is there a way i can do this at one place and it will be formatted.
I remember reading something about Thread CurrentCulture long time ago?
How can i get this done? any ideas?
Upvotes: 1
Views: 975
Reputation: 13589
You can set the culture and UI culture via your web.config, using the globalization element of system.web
You may also consider adding a partial for DateTime in your DisplayTemplates:
Upvotes: 2
Reputation: 1082
You can consider something like below in your Global.asax:
using System.Globalization;
internal void Application_BeginRequest(object sender, EventArgs e)
{
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("tk-TR");
}
Upvotes: 0
Reputation: 10363
You can set your web application culture settings in you web.config file. For example the following one will use settings based on user's web browser language preferences:
<system.web>
<globalization uiCulture="auto" culture="auto" />
</system.web>
Alternatively you can set the specific values. List of cultures in .NET
Upvotes: 0