using System; namespace StringApplication { class StringProg { static void Main(string[] args) { string str = "2018-08-07 09:50"; Console.WriteLine(str); string substr = str.Substring(10); string str2="10:30"; Console.WriteLine(substr); Console.WriteLine("compare "+substr+" with "+str2); DateTime dt1=Convert.ToDateTime(substr); DateTime dt2=Convert.ToDateTime(str2); if(DateTime.Compare(dt1,dt2)>0) Console.WriteLine(substr+" later than "+str2); else Console.WriteLine(substr+" earlier "+str2); Console.ReadKey() ; } } }