简体   繁体   中英

Get item created date in Sitecore

Is there anyway we can get an item's created date programmatically under the Statistics section? Thanks.

Yes. Sitecore.Context.Item.Statistics.Created . This returns the item's created date as a DateTime object.

我试图获取媒体项目的创建日期,它的唯一工作方式是:

DateTime.ParseExact(item.InnerItem.Fields["__Created"].Value.Substring(0,8), "yyyyMMdd", CultureInfo.InvariantCulture)

There's one important detail that wasn't mentioned yet:

  • item.Created (returns the DateTime that the item was first created)
  • item.Statistics.Created (returns the DateTime that the latest version was created)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM