src/util/Date.php
public static function formattedTime($DateTime_str = 'now', $timestamp_format = null, $timezone = null) {
        if (!$timestamp_format) {
            $timestamp_format = static::$timestamp_format;
        }

        if (!$timezone) {
            $timezone = static::$timezone;
        }

        $tz = new \DateTimeZone($timezone);
        $time = new \DateTime($DateTime_str, $tz);

        if ($time->getTimeZone()->getName() !== $tz->getName()) {
            $time->setTimeZone($tz);
        }

        return $time->format($timestamp_format);
    }
public static function formattedTime($DateTime_str = 'now', $timestamp_format = null, $timezone = null) {
        if (!$timestamp_format) {
            $timestamp_format = static::$timestamp_format;
        }

        if (!$timezone) {
            $timezone = static::$timezone;
        }

        $tz = new \DateTimeZone($timezone);
        $time = new \DateTime($DateTime_str, $tz);

        if ($time->getTimeZone()->getName() !== $tz->getName()) {
            $time->setTimeZone($tz);
        }

        return $time->format($timestamp_format);
    }
public static function formattedTime ( $ DateTime_str = 'now' , $ timestamp_format = null , $ timezone = null ) { if ( ! $ timestamp_format ) { $ timestamp_format = static :: $ timestamp_format ; } if ( ! $ timezone ) { $ timezone = static :: $ timezone ; } $ tz = new \ DateTimeZone ( $ timezone ) ; $ time = new \ DateTime ( $ DateTime_str , $ tz ) ; if ( $ time -> getTimeZone ( ) -> getName ( ) !== $ tz -> getName ( ) ) { $ time -> setTimeZone ( $ tz ) ; } return $ time -> format ( $ timestamp_format ) ; }
Returns a date/time string with the specified timestamp format

$time = Date::formatted_time('5 minutes ago');

@link    http://www.php.net/manual/\DateTime.construct
@param   string $\DateTime_str       \DateTime string
@param   string $timestamp_format timestamp format
@param   string $timezone timezone identifier
@return  string
Returns a date / time string with the specified timestamp format