Null类型的DateTime怎么用在TimeSpan上!
太TM简单了。。
DateTime ts1 = Convert.ToDateTime(workinfo.WorkTime.ToString()); DateTime ts2 = Convert.ToDateTime(workinfo.ScoreTime.ToString()); TimeSpan ts = ts2 - ts1; string useTime = ts.TotalMinutes.ToString(); workinfo.UseTime = useTime+"分钟";
转换一下就行了,不然TimeSpan总是报错,不能隐式转换!!