2
Answers

Datetime format issue?

Kannabiran B

Kannabiran B

14y
4.3k
1
Hi,
  I finished developing the .net windows application.problem is in date format.the application developed with the date format of "MM/dd/yyyy" with this appication working fine.but now i want to change the dateformat to "dd/MM/yyyy" by setting this format im getting the folling error "String was not regcognized as valid date format". i have to change the format in one place so that it gets effect in all over the application.

i have tried withe the below code.but its not working.

CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
culture.DateTimeFormat.LongTimePattern = "";
System.Threading.Thread.CurrentThread.CurrentCulture = culture;

Regards
Kanna
Answers (2)