I have created a layout page and want to show last modified date (without time) of page

Using below to show last modified date but it is displaying time also

<SharePointWebControls:DateTimeField FieldName="Modified" runat="server" />
  • you need to set DateOnly attribute to true. Try it as <SharePointWebControls:DateTimeField FieldName="Modified" DateOnly="true" runat="server" /> and check – Gautam Sheth Feb 15 '19 at 10:57
  • @GautamSheth Getting message 'Sorry, something went wrong' after added DateOnly="true" – Vindhyachal Kumar Feb 15 '19 at 11:00
  • Could be casing, could you modify it as DateOnly="True" or DateOnly="TRUE" and check ? You can also try it as <SharePointWebControls:DateTimeField FieldName="Modified" DateOnly="true" EnableViewState="true" runat="server" /> ? – Gautam Sheth Feb 15 '19 at 11:03
  • I have tried it, still getting same error message – Vindhyachal Kumar Feb 15 '19 at 11:07

We can use JavaScript to remove time from Modified date as below sample code

<div class="page-content-footer container">
        <p class="date" id="mslastModifiedDateOnly">Last Reviewed: 
            <SharePointWebControls:DateTimeField FieldName="Modified" runat="server" />
            jQuery(document).ready(function () {
                jQuery('#mslastModifiedDateOnly').text('Last Reviewed: '+ jQuery('#mslastModifiedDateOnly').text().replace('Last Reviewed: ','').split(' ')[0]);
        <div id="pageFeedbackForm" class="form">
            <!-- COMPONENT - Page Feedback -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.