Forum

Hide the time in datestamp

 
Picture of Boris Weh
Hide the time in datestamp
 

Dear all,

My customer does not want to display a time for posts and blogs. Do you know how I can show the date for posts, blogs and similar interactions, but no time?

Thank you!

 
Average of ratings: -
Picture of Purnendu Dash
Re: Hide the time in datestamp
 

You can try the below given code for removing time and show only date in format of "Monday, 23 January 2017" instead of "Monday, 23 January 2017, 11:21 AM"

$by->date = date('l, d F Y',$entry->created );

Add the code in <your moodle>/theme/<your preferable theme>/renderers.php [which is recommended]

require_once($CFG->dirroot .'/blog/renderer.php');
class theme_<your preferable theme>_core_blog_renderer extends core_blog_renderer {
 /*overwrite render_blog_entry function here*/
public function render_blog_entry(blog_entry $entry) {

    .....
   /*use this code instead of $by->date = userdate($entry->created );
    $by->date = date('l, d F Y',$entry->created );
}

}

or, you can directly change the code in <your moodle>/blog/renderer.php in function render_blog_entry.


Regards,

Purnendu

 
Average of ratings: -