The problem is to convert a random formatted (12/08/12-08-2019/12AUG/120819 etc) into DateTime. Since format is not fixed I'm using TryParse, it does work for normal cases but not for "120819".
string text="270619";
DateTime dt=new DateTime();
Thread.CurrentThread.CurrentCulture=CultureInfo.GetCultureInfo("en-IN");
var result=
DateTime.TryParse(text,CultureInfo.CurrentCulture,DateTimeStyles.None,out dt);
Console.WriteLine(dt);
Expected date should be 27-06-2019 00:00:00
Edit: Currently I'm using formats={"ddMMyy","ddMMyyyy"} and its working, but TryParseExact then fails for the other format like dd-MM-yyyy. Guess I need to write down all the possible formats in there. Or use if else case using both TryParse and TryParseExact.