C#中的LINQ其中2日期之间日期 [英] C# Linq Where Date Between 2 Dates

查看:1067
本文介绍了C#中的LINQ其中2日期之间日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的LINQ语句来让我两个日期之间的所有记录,而我不太知道我需要改变,以得到它的工作:(a.Start&GT =的startDate和放大器;&安培;结束日期)

  VAR appointmentNoShow =
    从预约中
    从化学出版社
    从客户Ç
    其中,a.Id == p.OID&放大器;&安培; (a.Start.Date> = startDate.Date和放大器;&安培;结束日期)


解决方案

只需将其更改为

  VAR appointmentNoShow =从预约中
                                从化学出版社
                                从客户Ç
                                其中,a.Id == p.OID&放大器;&安培; (a.Start.Date> = startDate.Date和放大器;&安培; a.Start.Date< =结束日期)

I'm trying to get my linq statement to get me all records between two dates, and I'm not quite sure what I need to change to get it to work: (a.Start >= startDate && endDate)

var appointmentNoShow =
    from a in appointments
    from p in properties
    from c in clients
    where a.Id == p.OID && (a.Start.Date >= startDate.Date && endDate)

解决方案

Just change it to

  var appointmentNoShow = from a in appointments
                                from p in properties
                                from c in clients
                                where a.Id == p.OID && (a.Start.Date >= startDate.Date && a.Start.Date <= endDate)

这篇关于C#中的LINQ其中2日期之间日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆