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


PHP Date_Calc::endOfNextMonth方法代码示例

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


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

示例1: _getSpanDates

 /**
  * A private method that returns the start and end dates
  * that bound the span, based based on a pre-defined 'friendly'
  * value.
  *
  * See the {@link OA_Admin_DaySpan::setSpanPresetValue()} method
  * for the pre-defined values.
  *
  * @param string $presetValue The preset value string.
  * @return array An array of two elements, "start" and "end",
  *               representing the start and end dates of
  *               the span, respectively.
  */
 function _getSpanDates($presetValue)
 {
     switch ($presetValue) {
         case 'today':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'yesterday':
             $oDateStart = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'this_week':
             $oDateStart = new Date(Date_Calc::beginOfWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'last_week':
             $oDateStart = new Date(Date_Calc::beginOfPrevWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd->copy($oDateStart);
             $oDateEnd->addSpan($oSixDaySpan);
             break;
         case 'last_7_days':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             $oDateStart->subtractSpan($oSevenDaySpan);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'this_month_full':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month_remainder':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'next_month':
             $oDateStart = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::endOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'last_month':
             $oDateStart = new Date(Date_Calc::beginOfPrevMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:DaySpan.php

示例2: compare

compare('20001126', Date_Calc::endOfWeek(22, 11, 2000), 'endOfWeek');
compare('20001126', Date_Calc::endOfWeek('22', '11', '2000'), 'endOfWeek str');
compare('20001113', Date_Calc::beginOfPrevWeek(22, 11, 2000), 'beginOfPrevWeek');
compare('20001127', Date_Calc::beginOfNextWeek(22, 11, 2000), 'beginOfNextWeek');
compare('20001113', Date_Calc::beginOfPrevWeek('22', '11', '2000'), 'beginOfPrevWeek str');
compare('20001127', Date_Calc::beginOfNextWeek('22', '11', '2000'), 'beginOfNextWeek str');
compare('20001101', Date_Calc::beginOfMonth(11, 2000), 'beginOfMonth');
compare('20001101', Date_Calc::beginOfMonth('11', '2000'), 'beginOfMonth str');
compare('20001001', Date_Calc::beginOfPrevMonth(22, 11, 2000), 'beginOfPrevMonth');
compare('20001031', Date_Calc::endOfPrevMonth(22, 11, 2000), 'endOfPrevMonth');
compare('20001001', Date_Calc::beginOfPrevMonth('22', '11', '2000'), 'beginOfPrevMonth str');
compare('20001031', Date_Calc::endOfPrevMonth('22', '11', '2000'), 'endOfPrevMonth str');
compare('20001201', Date_Calc::beginOfNextMonth(22, 11, 2000), 'beginOfNextMonth');
compare('20001231', Date_Calc::endOfNextMonth(22, 11, 2000), 'endOfNextMonth');
compare('20001201', Date_Calc::beginOfNextMonth('22', '11', '2000'), 'beginOfNextMonth str');
compare('20001231', Date_Calc::endOfNextMonth('22', '11', '2000'), 'endOfNextMonth str');
compare('19991001', Date_Calc::beginOfMonthBySpan(-13, 11, 2000), 'beginOfMonthBySpan 1');
compare('20001001', Date_Calc::beginOfMonthBySpan(-1, 11, 2000), 'beginOfMonthBySpan 2');
compare('20001101', Date_Calc::beginOfMonthBySpan(0, 11, 2000), 'beginOfMonthBySpan 3');
compare('20001201', Date_Calc::beginOfMonthBySpan(1, 11, 2000), 'beginOfMonthBySpan 4');
compare('20011201', Date_Calc::beginOfMonthBySpan(13, 11, 2000), 'beginOfMonthBySpan 5');
compare('19990101', Date_Calc::beginOfMonthBySpan('-13', '02', '2000'), 'beginOfMonthBySpan 6 str');
compare('19990101', Date_Calc::beginOfMonthBySpan(-13, 2, 2000), 'beginOfMonthBySpan 6');
compare('20000101', Date_Calc::beginOfMonthBySpan(-1, 2, 2000), 'beginOfMonthBySpan 7');
compare('20000201', Date_Calc::beginOfMonthBySpan(0, 2, 2000), 'beginOfMonthBySpan 8');
compare('20000301', Date_Calc::beginOfMonthBySpan(1, 2, 2000), 'beginOfMonthBySpan 9');
compare('20010301', Date_Calc::beginOfMonthBySpan(13, 2, 2000), 'beginOfMonthBySpan 10');
compare('20010301', Date_Calc::beginOfMonthBySpan('13', '02', '2000'), 'beginOfMonthBySpan 10 str');
compare('19991031', Date_Calc::endOfMonthBySpan(-13, 11, 2000), 'endOfMonthBySpan 1');
compare('20001031', Date_Calc::endOfMonthBySpan(-1, 11, 2000), 'endOfMonthBySpan 2');
compare('20001130', Date_Calc::endOfMonthBySpan(0, 11, 2000), 'endOfMonthBySpan 3');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php


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