string st1="12:13";
string st2="14:14";
DateTime dt1=Convert.ToDateTime(st1);
DateTime dt2=Convert.ToDateTime(st2);
DateTime dt3=DateTime.Now;
if(DateTime.Compare(dt1,dt2)>0)
Console.WriteLine (st1+">"+st2);
else
Console.WriteLine (st1+"<"+st2);
if (DateTime.Compare(dt1, dt3) > 0)
Console.WriteLine (st1.ToString()+">"+dt3.ToString());
else
Console.WriteLine ( st1.ToString() + "<" + dt3.ToString());
Console.ReadKey (); |
|