Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lewis Smith 199 posts 586 karma points c-trib
    Sep 06, 2017 @ 13:12
    Lewis Smith
    0

    Datetime Query

    Hi All,

    I'm trying to get all my blog posts that have release dates ("blogDate") later than today's date.

    My current query is

    var allBlogs = Model.Children().Where(x => x.IsVisible());
    

    In Umbraco the user chooses a blog date which has a property of 'blogDate'

    Is there a nice way of doing this without having to do something tedious like counting days?

    Thanks, Lewis

  • Lewis Smith 199 posts 586 karma points c-trib
    Sep 06, 2017 @ 13:20
    Lewis Smith
    100

    Managed to get the following query working:

    var allBlogs = Model.Children().Where(x => x.GetPropertyValue<DateTime>("blogDate") <= DateTime.Now.Date);
    

    Thanks, Lewis

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies