Let's say I have a document type with alias BlogPost
, which has properties:
- blogTitle (Text String)
- blogDate (DateTimePicker)
- blogBody (Rich Text Editor)
When getting the latest 5 blogs contained in the site, I would use the following snippet:
var blogList = CurrentPage.AncestorOrSelf(1).Descendants("BlogPost").OrderBy("blogDate desc").Take(5);
However, I am trying to retrieve the latest 5 blogs where the date lies in a specific range (for example: after 15 December 2014).
I know that you can use the Where
clause with a condition contained in a String
, but I am attempting to compare two DateTimes:
Convert.ToDateTime("blogDate") >= new DateTime(2014, 12, 15)
Is this possible to do with a Where
clause?