Ejemplo n.º 1
0
 /**
  * Converts the created_at, updated_at and published_at properties
  * to local time from gmt time.
  */
 private function _date_time_convert() {
     foreach (array('created_at', 'updated_at', 'published_at') as $var) {
         if (!$this->_is_new() and isset($this->_data[$var])) {
             $this->_data[$var] = Time::gmt_to_local($this->_data[$var]);
         }
     }
 }
Ejemplo n.º 2
0
/**
 * Returns the time ago in words with the 'ago' suffix.
 *
 * @param string $timestamp
 *
 * @return string
 */
function timeAgoInWords($timestamp)
{
    return $timestamp ? Language::translate('time.x_ago', [Time::agoInWords($timestamp)]) : null;
}