Blog Post Timestamp

Is there a way to add a timestamp to individual blog posts that will show what time the blog was posted?

Parents
  • Typically this is displayed from the Blog - Post Byline widget OOTB

    Change/customize the content-date section of the widget's main content block from:

    $core_v2_language.FormatDate($blogPost.PublishedDate)

    to 

    $core_v2_language.FormatDateAndTime($blogPost.PublishedDate)

  • This is great,  ! 

    Just a note, as I was looking at this – If your community is not gated, the time will show to non-logged-in users in (I believe) the time zone specified in Admin > Site > Identification options (mine is UTC).

    You can take this a little further and use this code (I believe it's correct, but definitely test before deploying!) to make the time only show when the viewer is logged in, so it'll utilize the user's defined timezone:

    OOB:

    <div class="content-date">
    	$core_v2_language.FormatDate($blogPost.PublishedDate)
    </div>

    Replace with:

    #if($accessingUserIsRegistered)
    	<div class="content-date">
    		$core_v2_language.FormatDateAndTime($blogPost.PublishedDate)
    	</div>
    #else
    	<div class="content-date">
    		$core_v2_language.FormatDate($blogPost.PublishedDate)
    	</div>
    #end

  • That's a good adjustment  . I saw that Verint deprecated the overload for AdjustTimeZone in FormatDateAndTime to convert to the accessing user's time zone, but I didn't know that they did so because it became the default behaviour.

Reply Children
No Data