View Code
DateTime date1= "2013-05-15"; DateTime date2=DateTime.Now; //获得date1到今天的相差的天数 TimeSpan ts = date1- DateTime.Now; int days=ts.Days;