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