protected function StatusReportController::getTimeAgo in Acquia Content Hub 8.2
Time ago formatting.
Parameters
int $time: Timestamp of last update.
Return value
string Time ago as formatting.
Throws
\Exception;
1 call to StatusReportController::getTimeAgo()
- StatusReportController::getLastUpdatedTime in modules/
acquia_contenthub_publisher/ src/ Controller/ StatusReportController.php - Determines most recent updated time.
File
- modules/
acquia_contenthub_publisher/ src/ Controller/ StatusReportController.php, line 478
Class
- StatusReportController
- Controller for Status Reports.
Namespace
Drupal\acquia_contenthub_publisher\ControllerCode
protected function getTimeAgo($time) {
if (!$time) {
return 'Not Found';
}
$date_formatter = \Drupal::service('date.formatter');
$time_ago = $date_formatter
->formatDiff($time, \Drupal::time()
->getRequestTime(), [
'granularity' => 2,
]);
return $time_ago;
}