comparing the two dates in c#
Posted on 2007-Dec-3 at 05:40 in ASP.NET
1)how to compare the two dates in c#
2)how to use the CompareTo method in c#
DateTime d1 = Convert.ToDateTime ("05 - 04 - 2007");
DateTime d2 = Convert.ToDateTime ("05 - 04 - 2007");
String a= d1.CompareTo (d2).ToString();
if d1>d2 then it returns 1
if d1'<'d2 then it returns -1
if d1=d2 then it returns 0
0 comments :: post a comment ::
link
