本文整理匯總了PHP中XenForo_Locale::_dayStartTimestamps方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Locale::_dayStartTimestamps方法的具體用法?PHP XenForo_Locale::_dayStartTimestamps怎麽用?PHP XenForo_Locale::_dayStartTimestamps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenForo_Locale
的用法示例。
在下文中一共展示了XenForo_Locale::_dayStartTimestamps方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDayStartTimestamps
/**
* Fetches timestamps for the start of today, yesterday or a week ago
*
* @return array [today, yesterday, week]
*/
public static function getDayStartTimestamps()
{
if (!self::$_dayStartTimestamps) {
$date = new DateTime('@' . XenForo_Application::$time);
$date->setTimezone(self::$_timeZone ? self::$_timeZone : new DateTimeZone('UTC'));
$date->setTime(0, 0, 0);
list($todayStamp, $todayDow) = explode('|', $date->format('U|w'));
$date->modify('-1 day');
$yesterdayStamp = $date->format('U');
$date->modify('-5 days');
$weekStamp = $date->format('U');
self::$_dayStartTimestamps = array('now' => XenForo_Application::$time, 'today' => $todayStamp, 'todayDow' => $todayDow, 'yesterday' => $yesterdayStamp, 'week' => $weekStamp);
}
return self::$_dayStartTimestamps;
}