Custom Page layout shows wrong last modified time

Recently I asked our developer to add a page last updated field to a custom layout. It looked all good until I started using it to create content pages. I noticed the time showing on the page is actually 10 hours ahead. Soon enough, I figured out it’s the UTC time.

I looked the line for the last modified field, it appears to be ok, as below:

<SharePoint:FieldValue FieldName=”Modified” runat=”server”/>

Until today, I decided to have another try and found out the reason. The control here is wrong. Instead of FieldValue, it should be DateTimeField.

<SharePoint:DateTimeField FieldName=”Modified” runat=”server”/>

This is the original post where I found out the problem.
Be careful when working with date & time in SharePoint

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s