Min and Max methods for DateTime

Math.Max Method doesn't have overload for DateTime
So I've created

        public static DateTime Min(DateTime t1, DateTime t2)

        {

            if (DateTime.Compare(t1, t2) > 0)

            {

                return t2;

            }

            return t1;

        }

        public static DateTime Max(DateTime t1, DateTime t2)

        {

            if (DateTime.Compare(t1, t2) < 0)

            {

                return t2;

            }

            return t1;

        }

 

posted @ Thursday, February 21, 2008 4:50 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 1 and 1 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011