摘要:
可以反加两个日期之间任何一个时间单位。private string DateDiff(DateTime DateTime1, DateTime DateTime2){string dateDiff = null; TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);Tim... 阅读全文
posted @ 2009-06-16 09:41
袁雷
阅读(444)
评论(0)
推荐(0)
摘要:
//大家在做报表或查询的时候都会有给用户预设一些可选的日期范围(如上图)//如本年度销售额、本季度利润、本月新增客户//C#里内置的DateTime基本上都可以实现这些功能,巧用DateTime会使你处理这些事来变轻松多了//今天 DateTime.Now.Date.ToShortDateString();//昨天,就是今天的日期减一 DateTime.Now.AddDays(-1).ToShor... 阅读全文
posted @ 2009-06-16 08:35
袁雷
阅读(342)
评论(0)
推荐(0)

浙公网安备 33010602011771号