关于日期的计算问题ASP.NET/C#/SQLSERVER2000
日期:2007-03-24 荐:
关于日期的计算问题ASP.NET/C#/SQLSERVER2000我想比较两个日期,DataTime1和DataTime2,比较哪个日期大(日期靠后)比较日期大多少?(日期靠后有多少天,比如相差20天)sql语句里DATEDIFF ( datepart , startdate , enddate )即DATEDIFF ( day, DataTime1, DataTime2)select DATEDIFF ( day , '2004-1-1' , '2005-1-1' ) as the_datediffTimeSpan span=new TimeSpan();span=date1-date2;double days=span.TotalDays;谢谢拉,老兄,我在*.CS里呢?DateTime d1 = new DateTime();DateTime d2 = new DateTime();d1 = DateTime.Now;d2 = DateTime.Now.AddDays(31);this.Label1.Text = Convert.ToString(d2 - d1);哦,你们说的都OK!谢谢啦,老兄!
标签: