当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Date::dayOfYear方法代码示例

本文整理汇总了PHP中Horde_Date::dayOfYear方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Date::dayOfYear方法的具体用法?PHP Horde_Date::dayOfYear怎么用?PHP Horde_Date::dayOfYear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Date的用法示例。


在下文中一共展示了Horde_Date::dayOfYear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toRRule20

 /**
  * Creates an iCalendar 2.0 recurrence rule.
  *
  * @link http://rfc.net/rfc2445.html#s4.3.10
  * @link http://rfc.net/rfc2445.html#s4.8.5
  * @link http://www.shuchow.com/vCalAddendum.html
  *
  * @param Horde_Icalendar $calendar  A Horde_Icalendar object instance.
  *
  * @return string  An iCalendar 2.0 conform RRULE value.
  */
 public function toRRule20($calendar)
 {
     switch ($this->recurType) {
         case self::RECUR_NONE:
             return '';
         case self::RECUR_DAILY:
             $rrule = 'FREQ=DAILY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_WEEKLY:
             $rrule = 'FREQ=WEEKLY;INTERVAL=' . $this->recurInterval;
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             for ($i = $flag = 0; $i <= 7; ++$i) {
                 if ($this->recurOnDay(pow(2, $i))) {
                     if ($flag == 0) {
                         $rrule .= ';BYDAY=';
                         $flag = 1;
                     } else {
                         $rrule .= ',';
                     }
                     $rrule .= $vcaldays[$i];
                 }
             }
             break;
         case self::RECUR_MONTHLY_DATE:
             $rrule = 'FREQ=MONTHLY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_MONTHLY_WEEKDAY:
             $nth_weekday = (int) ($this->start->mday / 7);
             if ($this->start->mday % 7 > 0) {
                 $nth_weekday++;
             }
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             $rrule = 'FREQ=MONTHLY;INTERVAL=' . $this->recurInterval . ';BYDAY=' . $nth_weekday . $vcaldays[$this->start->dayOfWeek()];
             break;
         case self::RECUR_YEARLY_DATE:
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval;
             break;
         case self::RECUR_YEARLY_DAY:
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval . ';BYYEARDAY=' . $this->start->dayOfYear();
             break;
         case self::RECUR_YEARLY_WEEKDAY:
             $nth_weekday = (int) ($this->start->mday / 7);
             if ($this->start->mday % 7 > 0) {
                 $nth_weekday++;
             }
             $vcaldays = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
             $rrule = 'FREQ=YEARLY;INTERVAL=' . $this->recurInterval . ';BYDAY=' . $nth_weekday . $vcaldays[$this->start->dayOfWeek()] . ';BYMONTH=' . $this->start->month;
             break;
     }
     if ($this->hasRecurEnd()) {
         $recurEnd = clone $this->recurEnd;
         $rrule .= ';UNTIL=' . $calendar->_exportDateTime($recurEnd);
     }
     if ($count = $this->getRecurCount()) {
         $rrule .= ';COUNT=' . $count;
     }
     return $rrule;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:69,代码来源:Recurrence.php


注:本文中的Horde_Date::dayOfYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。