C#判断某一时间在时间段内解决思路

C#判断某一时间在时间段内
如题,判断某一时间在时间段内,是用时间格式还是string来判断呢?有没有比较好的方法推荐下?谢谢

------解决方案--------------------
时间格式。
C# code

DateTime tomorrow = new DataTime(2008,7,2);
DateTime yestoday = new DataTime(2008,6,30);

DateTime today = DataTime.Today;

// then , today < tomorrow, today > yestoday

------解决方案--------------------
把所有的时间转换成Long型,然后在做比较,数值型的比较总比对象间的比较来的方便吧

------解决方案--------------------
C# code


        DateTime now = DateTime.Now;

        DateTime t1 = new DateTime(1990, 1, 1);
        DateTime t2 = new DateTime(2008, 12, 30);


        if (now > t1 && now < t2)
        {
            //
            string aa = "YES";
        }

------解决方案--------------------
转成数值再比较确实不错
------解决方案--------------------
我是这样来操作的
DateTime date = new DateTime(2010,12,25);
MessageBox.Show(DateTime.Now.CompareTo(date).ToString());

使用CompareTo(DateTime);
返回int类型

小于1表示方法内的时间比调用者的大.
0 表示相等
大于1调用者大于方法参数

还有就是Compare(t1,t2);
类似于t1.CompareTo(t2);

而string类型可以使用 DateTime.Parse(string); 来转换.
------解决方案--------------------
当然用时间格式了!!!
不用类型转换!!!
------解决方案--------------------
探讨
我是这样来操作的
DateTime date = new DateTime(2010,12,25);
MessageBox.Show(DateTime.Now.CompareTo(date).ToString());

使用CompareTo(DateTime);
返回int类型

小于1表示方法内的时间比调用者的大.
0 表示相等
大于1调用者大于方法参数

还有就是Compare(t1,t2);
类似于t1.CompareTo(t2);

而string类型可以使用 DateTime.Parse(string); 来转换.

------解决方案--------------------
学习了