码迷,mamicode.com
首页 > Windows程序 > 详细

C# 日期比较计算

时间:2020-06-29 13:42:13      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:com   console   write   比较   date   日期   end   convert   compare   

DateTime t1= DateTime.Now;
DateTime t2= Convert.ToDateTime(endTime);

 

if(DateTime.Compare(t1, t2) > 0) { Console.WriteLine(" t1 > t2 "); }

if(DateTime.Compare(t1, t2) == 0) { Console.WriteLine(" t1 == t2 "); }

if(DateTime.Compare(t1, t2) < 0) { Console.WriteLine(" t1 < t2 "); }

C# 日期比较计算

标签:com   console   write   比较   date   日期   end   convert   compare   

原文地址:https://www.cnblogs.com/JoeYD/p/13207294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!