當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Horde_Date::weekOfYear方法代碼示例

本文整理匯總了PHP中Horde_Date::weekOfYear方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Date::weekOfYear方法的具體用法?PHP Horde_Date::weekOfYear怎麽用?PHP Horde_Date::weekOfYear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde_Date的用法示例。


在下文中一共展示了Horde_Date::weekOfYear方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(Horde_Date $date)
 {
     $week = $date->weekOfYear();
     $year = $date->year;
     if (!$GLOBALS['prefs']->getValue('week_start_monday') && $date->dayOfWeek() == Horde_Date::DATE_SUNDAY) {
         ++$week;
     }
     if ($week > 51 && $date->month == 1) {
         --$year;
     } elseif ($week == 1 && $date->month == 12) {
         ++$year;
     }
     $this->year = $year;
     $this->week = $week;
     $day = Horde_Date_Utils::firstDayOfWeek($week, $year);
     if (!isset($this->startDay)) {
         if ($GLOBALS['prefs']->getValue('week_start_monday')) {
             $this->startDay = Horde_Date::DATE_MONDAY;
             $this->endDay = Horde_Date::DATE_SUNDAY + 7;
         } else {
             $day->mday--;
             $this->startDay = Horde_Date::DATE_SUNDAY;
             $this->endDay = Horde_Date::DATE_SATURDAY;
         }
     }
     $this->startDate = new Horde_Date($day);
     for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
         $this->days[$i] = new Kronolith_View_Day($day, array());
         $day->mday++;
     }
     $endDate = new Horde_Date($day);
     try {
         $allevents = Kronolith::listEvents($this->startDate, $endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $allevents = array();
     }
     for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
         $date_stamp = $this->days[$i]->dateString();
         $this->days[$i]->events = isset($allevents[$date_stamp]) ? $allevents[$date_stamp] : array();
     }
     $this->sidebyside = $this->days[$this->startDay]->sidebyside;
     $this->_currentCalendars = $this->days[$this->startDay]->currentCalendars;
     $this->slotsPerHour = $this->days[$this->startDay]->slotsPerHour;
     $this->slotsPerDay = $this->days[$this->startDay]->slotsPerDay;
     $this->slotLength = $this->days[$this->startDay]->slotLength;
 }
開發者ID:DSNS-LAB,項目名稱:Dmail,代碼行數:47,代碼來源:Week.php

示例2: weeksInYear

 /**
  * Returns the number of weeks in the given year (52 or 53).
  *
  * @param integer $year  The year to count the number of weeks in.
  *
  * @return integer $numWeeks   The number of weeks in $year.
  */
 public static function weeksInYear($year)
 {
     // Find the last Thursday of the year.
     $date = new Horde_Date($year . '-12-31');
     while ($date->dayOfWeek() != self::DATE_THURSDAY) {
         --$date->mday;
     }
     return $date->weekOfYear();
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:16,代碼來源:Date.php


注:本文中的Horde_Date::weekOfYear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。