Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

In my system formatted and installed the Windows 7 Ultimate. after that the OS taken default date time format dd-mm-yyyy. this is not valid for my hosted asp.net web application, So I changed my system datetime format as MM/dd/yyyy, here when I tested the my web application in local they showing my changed datetime format.

But when I hosted this web application my IIS it is returning Old format i.e., dd-mm-yyyy,
So how can I resolve this.


thanks in advance...........
Posted

1 solution

By adding a format provider to DateTime.ToString(). E.g.
C#
DateTime someWhen= DateTime.Now;
string str = someWhen.ToString("MM/dd/yyyy");
 
Share this answer
 
Comments
U@007 2-Aug-13 2:49am    
hi Bernhard,
I know if I give format they work. I don't want to give a format.
any way when I run locally it's working fine without format.

my question is Why IIS taken old format? even though I uninstall and install the IIs it is taken old format.

If I change system date time format IIS should be taken, but why it is not taken? If IIS take a changed date time format What I do?
Bernhard Hiller 2-Aug-13 5:53am    
Then change the CurrentCulture and CurrentUICulture of your web app. That might be tricky because every new thread inherits that from the Windows System, not from the main application.
The Regional Settings are applied per user, I think. And because IIS is runing with a different account, your change of settings does not apply to IIS.
U@007 5-Aug-13 0:46am    
hi hiller,

I had trying to change the CurrentCulture and CurrentUICulture in my IIS Settings of .Net Globalization, but here I want (UTC-06:00) Central Time (US & Canada) format is not their.

So how can I change this?
Balu Mate 25-Jun-15 6:03am    
dude can you please tell me the how to change CurrentCulture and CurrentUICulture in iis7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900