Reputation: 75
When I'm using DateTime in dd-MM-yyyy
format.
When I debug my code at localhost its works fine.
But After deploying my ASP.NET web project on IIS server DateTime changes to mm-dd-yyyy
format automatically.I'm facing many issues because of this problem.
I'm not able to find any solution, please let me know how can I solve this.
How can I get rid of this issue.?
Upvotes: 0
Views: 6238
Reputation: 19365
Your IIS probably has another Localization selected, than on your development machine.
Printing should be pretty simple if you specify the format: yourDate.ToString("dd.MM.yyyy");
Parsing a date has been a problem for me in the past. You can change the server settings or specify a CultureInfo directly in the code, like this:
DateTime.ParseExact(myDateString, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None);
Upvotes: 1
Reputation: 116
1) Change the datetime format of your server from:
Control Panel -> Regional and Language Options -> Advanced
2) Open IIS and follow below steps: (For IIS7)
Upvotes: 3