Copied to clipboard

Flag this post as spam?

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


  • loic ponchon 36 posts 56 karma points
    Sep 12, 2011 @ 16:32
    loic ponchon
    0

    Get publication date

    Hello,

    How can i get the publication date of a content ? using a macro.

    Thank you by advance

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 12, 2011 @ 16:47
    Sebastiaan Janssen
    0

    In your Razor file, use:

    @Model.CreateDate
  • loic ponchon 36 posts 56 karma points
    Sep 13, 2011 @ 11:26
    loic ponchon
    0

    I prefered to use UpdatedDate.

    What i want now i to implement it in the foreach.

    Here is my code :

    @if (!string.IsNullOrEmpty(Model.publicationEndDate.ToString()))
    {
        foreach (var item in Model.Children.Where("umbracoNaviHide != true").OrderBy("UpdateDate"))
        {
            if (item.UpdateDate > Model.publicationEndDate)
            {
                <h3 class="headline">
                <a href="@item.Url">@item.Title</a>
                </h3>
                <small class="meta">
                    Posted: @umbraco.library.LongDate(@item.UpdateDate.ToString(), true" - ")
                </small>
                <br />
                <p class="introduction">
                    @item.description
                </p>
            }
        }
    }
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2011 @ 12:08
    Sebastiaan Janssen
    0

    Alright no problem, so what is the issue you run into now? Is the expected output wrong, do you get errors?

Please Sign in or register to post replies

Write your reply to:

Draft