In textbox we have different different date formats for eg. 'dd-MMM-yy','yyyy-MM-dd' etc.
this format sometime throw errors like
string was not recognized as a valid datetime.
And for this type of error we are using following code which can convert all the date format into given Culture.
GetCultureInfo():Retrieves a cached, read-only instance of a culture using the specified culture name
Convert.ToDateTime(TextBoxID.Text,System.Globalization.CultureInfo.GetCultureInfo(" hi-IN").DateTimeFormat);
this format sometime throw errors like
string was not recognized as a valid datetime.
And for this type of error we are using following code which can convert all the date format into given Culture.
GetCultureInfo():Retrieves a cached, read-only instance of a culture using the specified culture name
Convert.ToDateTime(TextBoxID.Text,System.Globalization.CultureInfo.GetCultureInfo("
No comments:
Post a Comment