Backend\Core\Engine\DataGridFunctions::getTimeAgo PHP Method

getTimeAgo() public static method

Get time ago as a string for use in a datagrid
public static getTimeAgo ( integer $timestamp ) : string
$timestamp integer The UNIX-timestamp to convert in a time-ago-string.
return string
    public static function getTimeAgo($timestamp)
    {
        $timestamp = (int) $timestamp;
        // get user setting for long dates
        $format = Authentication::getUser()->getSetting('datetime_format');
        // get the time ago as a string
        $timeAgo = \SpoonDate::getTimeAgo($timestamp, BackendLanguage::getInterfaceLanguage(), $format);
        return '<time data-toggle="tooltip" datetime="' . \SpoonDate::getDate('Y-m-d H:i:s', $timestamp) . '" title="' . \SpoonDate::getDate($format, $timestamp, BackendLanguage::getInterfaceLanguage()) . '">' . $timeAgo . '</time>';
    }