Reputation: 7290
I'm deploying a .NET applications to another machine.
in console application, the value of
DateTime.Today.ToLongDateString();
is
10 December 2009
while in web application the value is
23 ذو الحجة 1430 < equivalent in higri calendar
How does the web application get the culture from, and why is it different than the console application?
Upvotes: 2
Views: 1782
Reputation: 1976
In the web.config or machine.config you can specify the default culture for the ASP.Net application through the globalization element.
<configuration>
<system.web>
<globalization
culture="en-US"/>
</system.web>
</configuration>
Upvotes: 4
Reputation: 1500525
It's likely to be the culture of the machine itself - you say you're deploying to a different machine.
Which culture do you want it to be in?
EDIT: Your options are:
The last one is the least invasive, to be honest. Most methods like String.Parse
etc have an overload with an IFormatProvider
parameter. You can specify this as the relevant CultureInfo
.
Upvotes: 2
Reputation: 7290
I got the answer! it was one of the registry records of the users of probably ASPNET or IIS. by using regedit, i found in one of the users international = arabic
Thanks to: Change Default Locale in IIS 6.0
Upvotes: 1
Reputation: 28834
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
DateTime.Today.ToLongDateString();
Upvotes: 0
Reputation: 120937
It gets it from the machine. See here how you can change it.
Upvotes: 2