We are using DD4T 1.31 in our MVC Application. While rendering the LastPublishedDate through DD4T.COntentModel.Page we are getting default value i.e. 01/01/0001 for the Tridion Page. When we checked in Broker Database, we could see the correct date set in the "Last Published Date" Key. Can anyone help us know why DD4T is not getting the right date or is there any other way to get this.
The last published date information is not part of page model instead it is part of pagemeta model. So in page model you will see the date as 01/01/0001 which is nothing but the minimum value for date.
Use following code snippet to retrieve the last published date using DD4T:
var metaFactory = new PageMetaFactory(<Publication Id>); var pageMeta = metaFactory.GetMeta(<Uri of the page>); var lastPublishedDateTime = pageMeta.LastPublicationDate;
We also faced the same issue and while debugging we found that it is part of pagemeta and not page. We are using this in our implementation and it is working fine.