Parsing Datetime to a different format

By [)ia6l0 iii

Use IFormatProvider to do DateTime.Parse for different cultures.

IFormatProvider can be used to do DateTime Conversions to various other cultures. The following sample shows conversion of a datetime variable value to French culture.

IFormatProvider myCulture = new CultureInfo("fr-Fr", true);
DateTime dt = DateTime.Parse(myDateTimeString, myCulture, DateTimeStyles.NoCurrentDateDefault);

Parsing Datetime to a different format  (998 Views)