查询当天的内容:select * from article where datediff(day,时间字段,getdate())=0
本周:select * from article where datediff(week,时间字段,getdate())=0
DateTime dd = (DateTime)ds.Tables[0].Rows[i]["pubdate"];
if (DateTime.Now.Date < dd.Date.AddDays(30)){ System.TimeSpan timeSpan = (System.TimeSpan)(DateTime.Now - dd.Date); ds.Tables[0].Rows[i]["day"] = timeSpan.Days.ToString() + "天前";}
转载于:https://www.cnblogs.com/terrorpig/archive/2009/01/08/1371778.html