c# date from string code example
Example 1: c# string to datetime
string iDate = "05/05/2005";
DateTime oDate = Convert.ToDateTime(iDate);
MessageBox.Show(oDate.Day + " " + oDate.Month + " " + oDate.Year );
Example 2: c# convert object to string
Object obj=new Object();
obj="hi";
string str1=Convert.ToString(obj);
string str2=obj.ToString();
string str3= obj as string;
string str4=(string)obj;
Example 3: string to datetime c#
DateTime.TryParse(stringDate, out DateTime date);
Example 4: c# string to datetime
.Net str to DateTime