本文整理匯總了PHP中cmsFramework::localDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP cmsFramework::localDate方法的具體用法?PHP cmsFramework::localDate怎麽用?PHP cmsFramework::localDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cmsFramework
的用法示例。
在下文中一共展示了cmsFramework::localDate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: niceShort
/**
* 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);
}