DateTime.ParseExact - culturewise Date Comparision
Hello.. Whenever dealing with cultures, DateTime format is always a headache to handle. to the date format in Textbox sometimes does not meet the format of culture. in that case DateTime.ParseExact is good option to handle. convert the date into current culture format from display culture format using public static DateTime ParseExact( string str, string Dateformat, IFormatProvider provider) Parameters s tr Type: System.String A string that contains a date and time to convert. Dateformat Type: System.String A format specifier that defines the required format of s . provider Type: System.IFormatProvider An object that supplies culture-specific format information about s . example DateTime sessionDate = DateTime.ParseExact(txtDate.Text, "M-d-yyyy", provider); here provide is CultureInfo provider = CultureInfo.InvariantCulture; this will get txtDate.Text (Date) into culture wise date format to compare with database formatted datetime. Hope thi...