A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 胡元江 中级黑马   /  2013-2-6 14:31  /  913 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文


                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 ();

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马