I use elgg 2.6.3.
I want to change the date time format of all events from duration time(from create date to now) to create date.
For example I want to change the "posted 1780 Days ago", to "posted on Dec 20, 2011".
How can I change this code for this issue? (this code return the date time format)
function elgg_get_friendly_time($time, $current_time = null) {
if (!$current_time) {
$current_time = time();
}
// return a time string to short circuit normal time formatting
$params = array('time' => $time, 'current_time' => $current_time);
$result = elgg_trigger_plugin_hook('format', 'friendly:time', $params, null);
if ($result) {
return $result;
}
$diff = abs((int)$current_time - (int)$time);
$minute = 60;
$hour = $minute * 60;
$day = $hour * 24;
if ($diff < $minute) {
return elgg_echo("friendlytime:justnow");
}
if ($diff < $hour) {
$granularity = ':minutes';
$diff = round($diff / $minute);
} else if ($diff < $day) {
$granularity = ':hours';
$diff = round($diff / $hour);
} else {
$granularity = ':days';
$diff = round($diff / $day);
}
if ($diff == 0) {
$diff = 1;
}
$future = ((int)$current_time - (int)$time < 0) ? ':future' : '';
$singular = ($diff == 1) ? ':singular' : '';
return elgg_echo("friendlytime{$future}{$granularity}{$singular}", array($diff));
}
I ask my question.
Just change this function as below (very simple and easy):
function elgg_get_friendly_time($time)
{
return elgg_echo(date("Y-m-d H:i:s", $time));
}