本文整理汇总了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);
}