Click here to Skip to main content
16,005,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am not talking about SQL server or Querries.

I am talking about, calendar controls any other date control.

When i choose 4 th march 2009,

i tried to set it as 04-03-2009 (dd-MM-yyyy)

but it turns me 03/04/2009 on server.

It runs fine on local. but on server i get 03/04/2009.

It is about IIS server setting and i already know that settings on IIS server is different.

I am asking how to change it?

I tried cultureinfo.GetCultureInfo but i got nothing.

It is not about client side but it is on Server side

give me as possible as fast ans

I tried also

C#
DateTimeFormatInfo format = new DateTimeFormatInfo();
           format.ShortDatePattern = "dd/MM/yyyy";
          DateTime bookingDate = Convert.ToDateTime(strDate, format)
;

result is nothing
Posted
Updated 5-Apr-12 1:41am
v3
Comments
AmitGajjar 5-Apr-12 8:07am    
Your problem is with Culture settings on your IIS server. you have two option either you change Culture manually on server or make you code Globalized.

dateValue.ToString("dd/MM/yyyy") will return you required value.
Here 'dateValue' contains the date that you have received from client side.
 
Share this answer
 
Write this code in your Application Startup file. i. e. Global.asax

C#
void Application_Start(object sender, EventArgs e)
{
	// Code that runs on application startup
	////Set date format
	CultureInfo newCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();

	newCulture.DateTimeFormat.ShortDatePattern = "dd-MMM-yyyy";

	Thread.CurrentThread.CurrentCulture = newCulture; 
}



I hope this will help you. i tried this.
 
Share this answer
 

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