When you are creating a SharePoint page layout and what to have a specific datetime format ex: Friday, 15 February 2008 it's not possible using just the publishing date field of SharePoint.

 But there is a very nice and clean trick:

Add a new calculated field to the content type that you are using on the page layout with the following formula:

=TEXT(DATEFIELD,"DATEFORMAT")

In the date format you can put "dddd, d mmmm yyyy" or "mmmm d-mm-yyyy" …

On your page layout add the html code behind:

<PublishingWebControls:EditModePanel runat=server id="EditModePanel2">
      <SharePointWebControls:DateTimeField ID="DateTimeField1" FieldName="DataPublicacao" runat="server"></SharePointWebControls:DateTimeField>
</PublishingWebControls:EditModePanel>
<PublishingWebControls:EditModePanel runat=server id="EditModePanel3" PageDisplayMode="Display">
      <SharePointWebControls:CalculatedField ID="CalculatedField1" FieldName="CustomDateField" runat="server"></SharePointWebControls:CalculatedField>
</PublishingWebControls:EditModePanel>

This will show on edit mode the datefield and on display mode the calculated field. 

You can use this trick on any list to show on your views different date formats.

LEAVE A REPLY

Please enter your comment!
Please enter your name here