/** * Returns a formatted descriptive date string for given datetime string. * * If the given date is today, the returned string could be "Today, 16:54". * If the given date was yesterday, the returned string could be "Yesterday, 16:54". * If $date_string's year is the current year, the returned string does not * include mention of the year. * * @param string $date_string Datetime string or Unix timestamp * @return string Described, relative date string */ function niceShort($date_string = null, $format = null, $offset = null) { $format = $format ? $format : __t("%b %d, %Y", true); $date = $date_string != null ? $this->fromString($date_string) : time(); if (is_null($offset)) { $date_string = cmsFramework::localDate($date_string); } if ($this->isToday($date)) { $ret = __l("Today", true); } elseif ($this->wasYesterday($date)) { $ret = __l("Yesterday", true); } else { $ret = $this->format($date, $format); } return $this->output($ret); }