本文整理汇总了PHP中CDate::getNextDay方法的典型用法代码示例。如果您正苦于以下问题:PHP CDate::getNextDay方法的具体用法?PHP CDate::getNextDay怎么用?PHP CDate::getNextDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDate
的用法示例。
在下文中一共展示了CDate::getNextDay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayWeeks
function displayWeeks($list, $task, $level, $fromPeriod, $toPeriod)
{
//start of week
$sd = new CDate($fromPeriod);
$days_from_start = $sd->getDayOfWeek();
for ($i = 0; $i < $days_from_start; $i++) {
$stmp = $sd->getPrevDay();
$sd = new CDate($stmp->format('%Y-%m-%d 00:00:00'));
}
//end of week
$ed = new CDate($toPeriod);
$days_spent = $ed->getDayOfWeek();
for ($i = 6 - $days_spent; $i > 0; $i--) {
$etmp = $ed->getNextDay();
$ed = new CDate($etmp->format('%Y-%m-%d 23:59:59'));
}
$st = new CDate($task->task_start_date);
$et = new CDate($task->task_end_date);
$row = '';
while ($sd->before($ed)) {
$sd_end = new CDate($sd->format('%Y-%m-%d 00:00:00'));
$sd_end->addSeconds(7 * 24 * 3600);
//add one week
if ($sd->after($st) && $sd_end->before($et) || $st->before($sd_end) && !$st->before($sd) || $et->after($sd) && !$et->after($sd_end)) {
/*
* generate visually distiguishable colors for up to 12 task levels
* Color will just be blue (#0000FF) for levels 12th and up.
*/
$red_key = 12 - floor($level / 3) * 3;
$red_key = $red_key > 15 ? 15 : ($red_key < 0 ? 0 : $red_key);
$green_key_1 = $red_key + 4 - $level % 3 * 4;
$green_key_1 = $green_key_1 > 15 ? 15 : ($green_key_1 < 0 ? 0 : $green_key_1);
$green_key_2 = $green_key_1 == $red_key ? 0 : $green_key_1;
$color_hex = mb_strtoupper('#' . dechex($red_key) . '0' . dechex($green_key_1) . dechex($green_key_2) . 'FF');
$row .= '<td nowrap="nowrap" style="background:' . $color_hex . ';" >';
} else {
$row .= '<td nowrap="nowrap">';
}
$row .= ' </td>';
$sd->addSeconds(7 * 24 * 3600);
//add one week
}
return $row;
}