1.获取日期之间天数的方法代码
string starttime=dtpStart1.Value.ToShortDateString();
DateTime start1 = Convert.ToDateTime(dtpStart1.Value);
string endtime = dtpEnd1.Value.ToShortDateString();
DateTime end1 = Convert.ToDateTime(dtpEnd1.Value);
TimeSpan ts = end1 - start1;
int number = ts.Days;
2.DataTime获取当前日期时的各种方法得到日期格式整理图片如下:DataTime.Now.ToString("yyyy-MM-dd HH:mm:ss")