You have to initialized the Cultureinfo under the globalization namespace.Convert between 'dd/MM/yyyy' & 'MM/dd/yyyy'
1) For Convert to "MM/dd/yyyy" :
IFormatProvider cl = new System.Globalization.CultureInfo("en-GB", true);
DateTime dts = new DateTime();
dts = Convert.ToDateTime(t1.Text, cl);
2) For Convert to "dd/MM/yyyy" :
IFormatProvider cl = new System.Globalization.CultureInfo("en-US", true);
DateTime dts = new DateTime();
dts = Convert.ToDateTime(t1.Text, cl);

0 comments:
Post a Comment