本文整理汇总了PHP中TimeHelper::niceShort方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeHelper::niceShort方法的具体用法?PHP TimeHelper::niceShort怎么用?PHP TimeHelper::niceShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeHelper
的用法示例。
在下文中一共展示了TimeHelper::niceShort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: niceShort
function niceShort($dateString = null, $timezone = null)
{
if (!$dateString) {
return '-';
}
$ret = parent::niceShort($dateString, $timezone);
$aReplaceENG = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jul', 'Jun', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
$aReplace = array(__('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jul'), __('Jun'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec'));
return $ret;
return str_replace(array('st', 'nd', 'th'), '', str_replace($aReplaceENG, $aReplace, $ret));
}
示例2: 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 $dateString's year is the current year, the returned string does not
* include mention of the year.
*
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string Described, relative date string
* @access public
* @link http://book.cakephp.org/view/1471/Formatting
*/
function niceShort($dateString = null, $userOffset = null)
{
return parent::niceShort($dateString, $this->__userOffset($dateString, $userOffset));
}