Sometime we need to show item created date and time in Sitecore. Here are some of the possible
ways to show on aspx or ascx control.
I am using repeater here but you can directly use on
page
<asp:Repeater ID="rpCars" ItemType="Sitecore.Data.Items.Item" runat="server">
<ItemTemplate>
<p>
<strong>
Way 1 : <%# Item.Fields[Sitecore.FieldIDs.Created].Value %> <br />
Way 2 : <%# Item.Fields["__Created"].Value %> <br />
Way 3 : <sc:FieldRenderer ID="FieldRenderer1" FieldName="__Created" runat="server" DataSource="<%#: Item.ID %>" /> <br />
Way 4 : <%# Sitecore.DateUtil.FormatIsoDate(Item.Fields[Sitecore.FieldIDs.Created].Value, "dd-MMM-yyyy hh:mm") %>
</strong>
</p>
</ItemTemplate>
</asp:Repeater>
Thanks a lot!
ReplyDelete