Search code examples
c#tridion

How to retrieve latest publishing date of a page and modified date for current version using C# in Tridion 2011?


In one of my pages published from SDL Tridion 2011 CMS, there is a requirement to show the latest revision date (i.e. the date of current modified version of the page) and the last published date of page. Can anyone suggest how this can be achieved using SDL Tridion 2011 .


Solution

  • Given that your template code is being executed at publish time, to output the latest publish date in a ComponentPresentation or Page, you can just use DateTime.Now

    As others have suggested access the Revision Date in the .Info classes.

    If you are using DWT or XSLT templates you will either need to make a TBB to place this value in the package, and then output it with your Layout template, or use a custom Function Source to output the value directly.

    But please specify what kind of templates you are using so we can give a fuller answer