本文整理汇总了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')));
//.........这里部分代码省略.........
示例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');