本文整理汇总了PHP中Date_Calc::nextWeekday方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::nextWeekday方法的具体用法?PHP Date_Calc::nextWeekday怎么用?PHP Date_Calc::nextWeekday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::nextWeekday方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNextWeekday
/**
* Get a Date object for the weekday after this one
*
* Get a Date object for the weekday after this one.
* The time of the returned Date object is the same as this time.
*
* @access public
* @return object Date Date representing the next weekday
*/
function getNextWeekday()
{
$day = Date_Calc::nextWeekday($this->day, $this->month, $this->year, "%Y-%m-%d");
$date = sprintf("%s %02d:%02d:%02d", $day, $this->hour, $this->minute, $this->second);
$newDate = new Date();
$newDate->setDate($date);
return $newDate;
}
示例2: SkipWeekend
protected function SkipWeekend($occurrence)
{
// Figure out the next day if we're supposed to skip one.
// We don't need to do this if we're just going to continue
// the frequency loop to the next instance.
if ($this->skip > 0) {
// Split out the components of the new working date.
list($y, $m, $d) = explode('-', $occurrence);
$dow = Date_Calc::dayOfWeek($d, $m, $y);
if ($dow == 6 || $dow == 0) {
if ($this->skip == 2) {
// Skip to the next weekday
$occurrence = Date_Calc::nextWeekday($d, $m, $y);
} else {
// Monthly recurrences are on specific dates, so don't
// just stip to the next one- return NULL so the
// calling function knows to ignore this instance
$occurrence = NULL;
}
}
}
return $occurrence;
}
示例3: getNextWeekday
/**
* Get a Date object for the weekday after this one
*
* The time of the returned Date object is the same as this time.
*
* @return object Date object representing the next week-day
* @access public
*/
function getNextWeekday()
{
$ret = new Date($this);
list($hs_year, $hs_month, $hs_day) = explode(" ", Date_Calc::nextWeekday($this->day, $this->month, $this->year, "%Y %m %d"));
$ret->setDayMonthYear($hs_day, $hs_month, $hs_year);
return $ret;
}
示例4: compare
compare($exp, Date_Calc::getCalendarWeek('27', '11', '2000'), 'getCalendarWeek 3 str');
$exp = array(array('20001030', '20001031', '20001101', '20001102', '20001103', '20001104'), array('20001105', '20001106', '20001107', '20001108', '20001109', '20001110', '20001111'), array('20001112', '20001113', '20001114', '20001115', '20001116', '20001117', '20001118'), array('20001119', '20001121', '20001122', '20001123', '20001124', '20001125', '20001126'), array('20001127', '20001128', '20001129', '20001130', '20001201', '20001202', '20001203'));
compare($exp, Date_Calc::getCalendarMonth(11, 2000), 'getCalendarMonth');
compare($exp, Date_Calc::getCalendarMonth('11', '2000'), 'getCalendarMonth str');
// I don't feel like dealing with this right now...
//compare('', Date_Calc::getCalendarYear(2000), 'getCalendarYear');
compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay');
compare('20001123', Date_Calc::nextDay(22, 11, 2000), 'nextDay');
compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay str');
compare('20001123', Date_Calc::nextDay('22', '11', '2000'), 'nextDay str');
compare('20001117', Date_Calc::prevWeekday('19', '11', '2000'), 'prevWeekday 1 str');
compare('20001117', Date_Calc::prevWeekday(19, 11, 2000), 'prevWeekday 1');
compare('20001121', Date_Calc::prevWeekday(22, 11, 2000), 'prevWeekday 2');
compare('20001123', Date_Calc::nextWeekday(22, 11, 2000), 'nextWeekday 1');
compare('20001127', Date_Calc::nextWeekday(24, 11, 2000), 'nextWeekday 2');
compare('20001127', Date_Calc::nextWeekday('24', '11', '2000'), 'nextWeekday 2 str');
compare('20001121', Date_Calc::prevDayOfWeek('2', '22', '11', '2000'), 'prevDayOfWeek 1 str');
compare('20001121', Date_Calc::prevDayOfWeek(2, 22, 11, 2000), 'prevDayOfWeek 1');
compare('20001115', Date_Calc::prevDayOfWeek(3, 22, 11, 2000), 'prevDayOfWeek 2');
compare('20001122', Date_Calc::prevDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'prevDayOfWeek 3');
compare('20001122', Date_Calc::nextDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'nextDayOfWeek 1');
compare('20001129', Date_Calc::nextDayOfWeek(3, 22, 11, 2000), 'nextDayOfWeek 2');
compare('20001123', Date_Calc::nextDayOfWeek(4, 22, 11, 2000), 'nextDayOfWeek 3');
compare('20001123', Date_Calc::nextDayOfWeek('4', '22', '11', '2000'), 'nextDayOfWeek 3 str');
compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore('2', '22', '11', '2000'), 'prevDayOfWeekOnOrBefore 1 str');
compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore(2, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 1');
compare('20001122', Date_Calc::prevDayOfWeekOnOrBefore(3, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 2');
compare('20001122', Date_Calc::nextDayOfWeekOnOrAfter(3, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 1');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter(4, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 2');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter('4', '22', '11', '2000'), 'nextDayOfWeekOnOrAfter 2 str');
compare('20001120', Date_Calc::beginOfWeek('22', '11', '2000'), 'beginOfWeek str');