c# – 预测日期时间的未来天数
发布时间:2020-12-16 01:41:43 所属栏目:百科 来源:网络整理
导读:我有这个DateTime对象: model.Model.Results.FloatingComponent().Schedule.ScheduleRows[0].Payment.FromDate.AdjustedDate 我如何知道将来会有多少天,如果是将来? 解决方法 TimeSpan delta = Foo.AdjustedDate - DateTime.Now;if(delta.Days 0){ //...}
我有这个DateTime对象:
model.Model.Results.FloatingComponent().Schedule.ScheduleRows[0].Payment.FromDate.AdjustedDate 我如何知道将来会有多少天,如果是将来? 解决方法TimeSpan delta = Foo.AdjustedDate - DateTime.Now; if(delta.Days > 0) { //... } 编辑: 根据@ Gabe的评论,这里只关注日期: TimeSpan delta = Foo.AdjustedDate.Date - DateTime.Today; if(delta.Days > 0) { //... } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |