Hi
Here i just did some code for your requirement.
this is just for testing only.
string Datestring = "Date of Birth : 07/12/1989";
if (Datestring.IndexOf(':') > 0)
{
string datestr = Datestring.Split(':')[0];
string datefrmt = Datestring.Split(':')[1];
if (datefrmt.IndexOf('/') > 0)
{
datefrmt = datefrmt.Trim();
string date1 = datefrmt.Split('/')[0];
string mnt = datefrmt.Split('/')[1];
string yr = datefrmt.Split('/')[2];
int datr, mntr, yre;
if (int.TryParse(date1, out datr) && int.TryParse(mnt, out mntr) && int.TryParse(yr, out yre))
{
}
}
else
{
if (datefrmt.IndexOf('-') > 0)
{
}
else
{
string date1 = datefrmt.Split(' ')[1];
string mnt = datefrmt.Split(' ')[2];
string yr = datefrmt.Split(' ')[3];
int datr, mntr, yre;
int monthIndex;
string[] MonthNames = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames;
monthIndex = Array.IndexOf(MonthNames, mnt) + 1;
if (int.TryParse(date1.Replace("th",""), out datr) && (monthIndex>0) && int.TryParse(yr, out yre))
{
}
}
}
}
In the above code you need to change some to achieve your requirement this is just for giving you idea how to do.
and i did exactly string what you want with white spaces also.
I hope you understood what I did.
you can reduce that code using Regular Expressions.
All the Best