简体   繁体   中英

Using date field comparisons in RavenDB LINQ queries

In RavenDB, I would like to query the database using a date field. How can I write a LINQ query to query the RavenDB that involves date comparison..

Session.Query<Movie>()
.Where(x => x.Status == "New" && x.ReleaseDate > DateTime.Parse("04/03/2012 00:00:00"))
.Dump();

is returning zero records inm LINQ pad. Something is not right the way I wrote the query.. thanks for any help.

Instead of DateTime.Parse() try instantiating a new DateTime.

Session.Query<Movie>()
.Where(x => x.Status == "New" && x.ReleaseDate > new DateTime(2012, 4, 3))
.Dump();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM