Copied to clipboard

Flag this post as spam?

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


  • sun 403 posts 395 karma points
    Mar 30, 2009 @ 05:44
    sun
    0

    How to get releaseDate of a content?

    Who can help me?

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 30, 2009 @ 11:06
    Douglas Robar
    0

    Umbraco keeps two different dates for every node.. the date it was created and the date it was last updated.

    You can get these in xslt with:

    [code]Current page was created on:

    Current page was last updated on: [/code]

    You can format the date using the various built-in umbraco.library functions, such as those shown at http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/FormatDateTime

    cheers,
    doug.

  • sun 403 posts 395 karma points
    Mar 31, 2009 @ 02:42
    sun
    0

    I just want to get releaseDate neither createDate nor updateDate.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 31, 2009 @ 12:49
    Peter Dijksterhuis
    0

    Umbraco does NOT have a property called 'releaseDate'. The dates it does have are mentioned by Douglas (createDate and updateDate).

    You probably would have to create your own property called 'releaseDate'

    HTH,
    PeterD

  • Stephan Lonntorp 195 posts 212 karma points
    Mar 31, 2009 @ 13:00
    Stephan Lonntorp
    0

    I think what you are referring to is the date used for delayed publish, unfortunately it isn't available in xslt, since only published content goes in the umbraco cached xml.

    So, since your document isn't published yet, it won't be available from xslt.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 31, 2009 @ 20:34
    Douglas Robar
    0

    Or, perhaps you just need to create your own releaseDate property on the document type as PeterD suggests. I do this when importing content from an existing site that needs to keep the "original" or "official" date.

    Here are two forum threads that discuss that approach:
    [url]http://forum.umbraco.org/yafpostst4149Changing-createDate-manually.aspx[/url]

    [url]http://forum.umbraco.org/yafpostst4613Using-the-documentservice--not-possible-to-set-createDate.aspx[/url]

    cheers,
    doug.

  • Jamie Howarth 306 posts 773 karma points c-trib
    Jan 07, 2011 @ 12:34
    Jamie Howarth
    1

    Just had this problem myself. Rather than resorting to my own field, I used a helper method:

    public static string ReleaseDate(int nodeId) {
    Document d = new Document(nodeId);
    return d.ReleaseDate.ToString();
    }

    I know this thread is a year old, but I hope it helps somebody down the line.

    Benjamin

  • QuasPie 25 posts 85 karma points
    Apr 09, 2014 @ 12:09
    QuasPie
    0

    Thanks Benjamin for the neat and working function!

    In addition you need the...

    using umbraco.cms.businesslogic.web;

    ...assembly to use Document in your C# class.

    It's in the cms.dll

Please Sign in or register to post replies

Write your reply to:

Draft