System.DateTime currentTime = new System.DateTime();
//取当前年月日时分秒
currentTime = System.DateTime.Now;
//取当前年
int curYear = currentTime.Year;
//取当前月
int curMon = currentTime.Month;
//取当前日
int curDay = currentTime.Day;
//DateTime d1=DateTime.Parse("2006-06-07 13:20:25");
//DateTime d2=DateTime.Parse("2006-06-07 18:25:25");
//DateTime d2=DateTime.Parse("2006-06-07 18:25:25");
DateTime d1=DateTime.Parse("2006-06-07 13:20");
DateTime d2=DateTime.Parse("2006-06-07 20:35");
DateTime d3=DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")+" 13:20:25");
System.TimeSpan ND=d2-d1;
int n=ND.Days; //天数差
int hn=ND.Hours; //小时差
int mn = ND.Minutes; //分钟差