lib/helpers/Date.php
public static function niceTimeDiff($d1, $d2, $limitPeriods = 2)
    {
        if (!is_int($d1)) {
            $d1 = self::strtotime($d1);
        }
        if (!is_int($d2)) {
            $d2 = self::strtotime($d2);
        }
        if (empty($d1) or empty($d2)) {
            return false;
        }
        $max = max($d1, $d2);
        $min = min($d1, $d2);
        $diff = $max - $min;

        return self::niceDuration($diff, $limitPeriods);
    }
public static function niceTimeDiff($d1, $d2, $limitPeriods = 2)
    {
        if (!is_int($d1)) {
            $d1 = self::strtotime($d1);
        }
        if (!is_int($d2)) {
            $d2 = self::strtotime($d2);
        }
        if (empty($d1) or empty($d2)) {
            return false;
        }
        $max = max($d1, $d2);
        $min = min($d1, $d2);
        $diff = $max - $min;

        return self::niceDuration($diff, $limitPeriods);
    }
public static function niceTimeDiff ( $ d1 , $ d2 , $ limitPeriods = 2 ) { if ( ! is_int ( $ d1 ) ) { $ d1 = self :: strtotime ( $ d1 ) ; } if ( ! is_int ( $ d2 ) ) { $ d2 = self :: strtotime ( $ d2 ) ; } if ( empty ( $ d1 ) or empty ( $ d2 ) ) { return false ; } $ max = max ( $ d1 , $ d2 ) ; $ min = min ( $ d1 , $ d2 ) ; $ diff = $ max - $ min ; return self :: niceDuration ( $ diff , $ limitPeriods ) ; }
Nice time difference.

@param string $d1           Date string
@param string $d2           Date string
@param int    $limitPeriods Number of periods to show (optional)

@return string Nice duration
Nice time difference .