本文整理汇总了PHP中Date_Calc::nextDay方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::nextDay方法的具体用法?PHP Date_Calc::nextDay怎么用?PHP Date_Calc::nextDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::nextDay方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNextDay
/**
* Get a Date object for the day after this one
*
* Get a Date object for the day 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 day
*/
function getNextDay()
{
$day = Date_Calc::nextDay($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: round
//.........这里部分代码省略.........
$hn_year = $pn_year;
$hn_day = 0;
$hn_hour = 0;
$hn_minute = 0;
$hn_second = 0;
$hn_firstofmonth = Date_Calc::firstDayOfMonth($pn_month, $pn_year);
$hn_midmonth = (Date_Calc::lastDayOfMonth($pn_month, $pn_year) + 1 - $hn_firstofmonth) / 2;
if (($hn_days = Date_Calc::dateToDays($pn_day, $pn_month, $pn_year) - $hn_firstofmonth) <= $hn_midmonth - 1) {
$hn_month = $pn_month;
} else {
if ($hn_days >= $hn_midmonth) {
// Round up:
//
list($hn_year, $hn_month) = Date_Calc::nextMonth($pn_month, $pn_year);
} else {
// Take time into account:
//
$hn_partday = Date_Calc::secondsPastMidnight($pn_hour, $pn_minute, $pn_second) / 86400;
if ($hn_partday >= $hn_midmonth - $hn_days) {
// Round up:
//
list($hn_year, $hn_month) = Date_Calc::nextMonth($pn_month, $pn_year);
} else {
$hn_month = $pn_month;
}
}
}
} else {
if ($pn_precision == DATE_PRECISION_DAY) {
$hn_year = $pn_year;
$hn_month = $pn_month;
$hn_hour = 0;
$hn_minute = 0;
$hn_second = 0;
if (Date_Calc::secondsPastMidnight($pn_hour, $pn_minute, $pn_second) >= 43200) {
// Round up:
//
list($hn_year, $hn_month, $hn_day) = explode(" ", Date_Calc::nextDay($pn_day, $pn_month, $pn_year, "%Y %m %d"));
} else {
$hn_day = $pn_day;
}
} else {
if ($pn_precision == DATE_PRECISION_HOUR) {
$hn_year = $pn_year;
$hn_month = $pn_month;
$hn_day = $pn_day;
$hn_minute = 0;
$hn_second = 0;
if (Date_Calc::secondsPastTheHour($pn_minute, $pn_second) >= 1800) {
// Round up:
//
list($hn_year, $hn_month, $hn_day, $hn_hour) = Date_Calc::addHours(1, $pn_day, $pn_month, $pn_year, $pn_hour);
} else {
$hn_hour = $pn_hour;
}
} else {
if ($pn_precision <= DATE_PRECISION_MINUTE) {
$hn_year = $pn_year;
$hn_month = $pn_month;
$hn_day = $pn_day;
$hn_hour = $pn_hour;
$hn_second = 0;
if ($pn_precision < DATE_PRECISION_MINUTE) {
$hn_minute = round($pn_minute, $pn_precision - DATE_PRECISION_MINUTE);
} else {
// Check seconds:
//
if ($pn_second >= 30) {
// Round up:
//
list($hn_year, $hn_month, $hn_day, $hn_hour, $hn_minute) = Date_Calc::addMinutes(1, $pn_day, $pn_month, $pn_year, $pn_hour, $pn_minute);
} else {
$hn_minute = $pn_minute;
}
}
} else {
// Precision is at least (DATE_PRECISION_SECOND - 1):
//
$hn_year = $pn_year;
$hn_month = $pn_month;
$hn_day = $pn_day;
$hn_hour = $pn_hour;
$hn_minute = $pn_minute;
$hn_second = round($pn_second, $pn_precision - DATE_PRECISION_SECOND);
if (fmod($hn_second, 1) == 0.0) {
$hn_second = (int) $hn_second;
if ($hn_second != intval($pn_second)) {
list($hn_year, $hn_month, $hn_day, $hn_hour, $hn_minute, $hn_second) = Date_Calc::addSeconds($hn_second - intval($pn_second), $pn_day, $pn_month, $pn_year, $pn_hour, $pn_minute, intval($pn_second), $pn_precision >= DATE_PRECISION_SECOND && $pb_countleap);
//
// (N.B. if rounded to nearest 10 seconds,
// user does not expect seconds to be '60')
}
}
}
}
}
}
}
return array((int) $hn_year, (int) $hn_month, (int) $hn_day, (int) $hn_hour, (int) $hn_minute, $hn_second);
}
示例3: w2PgetParam
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = (int) w2PgetParam($_GET, 'date', $today);
// establish the focus 'date'
$this_day = new w2p_Utilities_Date($date);
$dd = $this_day->getDay();
$mm = $this_day->getMonth();
$yy = $this_day->getYear();
// get current week
$this_week = Date_Calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY);
// prepare time period for 'events'
$first_time = clone $this_day;
$first_time->setTime(0, 0, 0);
$last_time = clone $this_day;
$last_time->setTime(23, 59, 59);
$prev_day = new w2p_Utilities_Date(Date_Calc::prevDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
$next_day = new w2p_Utilities_Date(Date_Calc::nextDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
// get the list of visible companies
$company = new CCompany();
global $companies;
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('Day View', 'icon.png', $m);
$titleBlock->addCrumb('?m=events&a=year_view&date=' . $this_day->format(FMT_TIMESTAMP_DATE), 'year view');
$titleBlock->addCrumb('?m=events&date=' . $this_day->format(FMT_TIMESTAMP_DATE), 'month view');
$titleBlock->addCrumb('?m=events&a=week_view&date=' . $this_week, 'week view');
$titleBlock->addCrumb('?m=events&a=day_view&date=' . $this_day->format(FMT_TIMESTAMP_DATE), 'day view');
$titleBlock->addCell(arraySelect($companies, 'company_id', 'onChange="document.pickCompany.submit()" class="text"', $company_id), '', '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="pickCompany" accept-charset="utf-8">', '</form>');
$titleBlock->addCell($AppUI->_('Company') . ':');
$titleBlock->addButton('New event', '?m=events&a=addedit&date=' . $today);
$titleBlock->show();
示例4: postcalendar_calendarblock_display
//.........这里部分代码省略.........
$pc_array_pos = 0;
$first_day = date('w', mktime(0, 0, 0, $the_month, 1, $the_year));
$end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year));
if ($end_dow != 6) {
$the_last_day = $last_day + (6 - $end_dow);
} else {
$the_last_day = $last_day;
}
break;
}
$month_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, 1, $the_year));
$month_view_end = date('Y-m-t', mktime(0, 0, 0, $the_month, 1, $the_year));
$today_date = postcalendar_today('%Y-%m-%d');
$starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, 1 - $first_day, $the_year));
$ending_date = date('m/t/Y', mktime(0, 0, 0, $the_month + $pcbeventsrange, 1, $the_year));
$eventsByDate =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'pcGetEvents', array('start' => $starting_date, 'end' => $ending_date));
$calendarView = Date_Calc::getCalendarMonth($the_month, $the_year, '%Y-%m-%d');
$sdaynames = array();
$numDays = count($pc_short_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($sdaynames, $pc_short_day_names[$pc_array_pos]);
$pc_array_pos++;
}
$daynames = array();
$numDays = count($pc_long_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($daynames, $pc_long_day_names[$pc_array_pos]);
$pc_array_pos++;
}
$dates = array();
while ($starting_date <= $ending_date) {
array_push($dates, $starting_date);
list($m, $d, $y) = explode('/', $starting_date);
$starting_date = Date_Calc::nextDay($d, $m, $y, '%m/%d/%Y');
}
$categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
if (isset($calendarView)) {
$tpl->assign_by_ref('CAL_FORMAT', $calendarView);
}
$tpl->assign_by_ref('A_MONTH_NAMES', $pc_month_names);
$tpl->assign_by_ref('A_LONG_DAY_NAMES', $pc_long_day_names);
$tpl->assign_by_ref('A_SHORT_DAY_NAMES', $pc_short_day_names);
$tpl->assign_by_ref('S_LONG_DAY_NAMES', $daynames);
$tpl->assign_by_ref('S_SHORT_DAY_NAMES', $sdaynames);
$tpl->assign_by_ref('A_EVENTS', $eventsByDate);
$tpl->assign_by_ref('A_CATEGORY', $categories);
$tpl->assign_by_ref('PREV_MONTH_URL', $pc_prev);
$tpl->assign_by_ref('NEXT_MONTH_URL', $pc_next);
$tpl->assign_by_ref('MONTH_START_DATE', $month_view_start);
$tpl->assign_by_ref('MONTH_END_DATE', $month_view_end);
$tpl->assign_by_ref('TODAY_DATE', $today_date);
$tpl->assign_by_ref('DATE', $Date);
$tpl->assign_by_ref('DISPLAY_LIMIT', $eventslimit);
$tpl->assign('TODAYS_EVENTS_TITLE', _PC_TODAYS_EVENTS);
$tpl->assign('UPCOMING_EVENTS_TITLE', _PC_UPCOMING_EVENTS);
$tpl->assign('NO_EVENTS', _PC_BLOCK_NO_EVENTS);
}
if ($showcalendar) {
// we need to create a unique ID for caching purposes
$output .= $tpl->fetch($template_name . '/views/calendarblock/month_view.html', $cacheid1);
}
if ($showevents) {
if ($showcalendar) {
$tpl->assign('SHOW_TITLE', 1);
} else {
$tpl->assign('SHOW_TITLE', 0);
}
// we need to create a unique ID for caching purposes
$output .= $tpl->fetch($template_name . '/views/calendarblock/todays_events.html', $cacheid2);
}
if ($nextevents) {
if ($showcalendar || $showevents) {
$tpl->assign('SHOW_TITLE', 1);
} else {
$tpl->assign('SHOW_TITLE', 0);
}
// we need to create a unique ID for caching purposes
$output .= $tpl->fetch($template_name . '/views/calendarblock/upcoming_events.html', $cacheid3);
}
if ($pcbshowsslinks) {
$output .= '<br /><br />';
$submit_event_url = pnModURL(__POSTCALENDAR__, 'user', 'submit');
$search_event_url = pnModURL(__POSTCALENDAR__, 'user', 'search');
$output .= '<center>';
if (PC_ACCESS_ADD) {
$output .= '[ <a href="' . $submit_event_url . '">' . _PC_SUBMIT_EVENT . '</a> ] ';
}
$output .= '[ <a href="' . $search_event_url . '">' . _PC_SEARCH_EVENT . '</a> ]';
$output .= '</center>';
}
// Populate block info and pass to theme
$blockinfo['content'] = $output;
return themesideblock($blockinfo);
}
示例5: postcalendar_userapi_buildView
//.........这里部分代码省略.........
$eventsByDate = array();
}
//=================================================================
// Create an array with the day names in the correct order
//=================================================================
$daynames = array();
$numDays = count($pc_long_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($daynames, $pc_long_day_names[$pc_array_pos]);
$pc_array_pos++;
}
unset($numDays);
$sdaynames = array();
$numDays = count($pc_short_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($sdaynames, $pc_short_day_names[$pc_array_pos]);
$pc_array_pos++;
}
unset($numDays);
//=================================================================
// Prepare some values for the template
//=================================================================
$prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d');
$next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d');
$pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$prev_day = Date_Calc::prevDay($the_day, $the_month, $the_year, '%Y%m%d');
$next_day = Date_Calc::nextDay($the_day, $the_month, $the_year, '%Y%m%d');
$pc_prev_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $prev_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$pc_next_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $next_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$prev_week = date('Ymd', mktime(0, 0, 0, $week_first_day_month, $week_first_day_date - 7, $week_first_day_year));
$next_week = date('Ymd', mktime(0, 0, 0, $week_last_day_month, $week_last_day_date + 1, $week_last_day_year));
$pc_prev_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $prev_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$pc_next_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $next_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$prev_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year - 1));
$next_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year + 1));
$pc_prev_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $prev_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
$pc_next_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $next_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
//=================================================================
// Populate the template
//=================================================================
$all_categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
if (isset($calendarView)) {
$tpl->assign_by_ref('CAL_FORMAT', $calendarView);
}
if ($viewtype == "week") {
$last_blocks = array();
foreach ($eventsByDate as $cdate => $day) {
$tblock = array_reverse($day['blocks']);
$last_blocks[$cdate] = count($tblock) - 1;
for ($i = 0; $i < count($tblock); $i++) {
if (!empty($tblock[$i])) {
$last_blocks[$cdate] = count($tblock) - $i;
break;
}
}
}
$tpl->assign("last_blocks", $last_blocks);
}
$tpl->assign('STYLE', $GLOBALS['style']);
示例6: array
$exp = array('19000226', '19000227', '19000228', '19000301', '19000302', '19000303', '19000304');
compare($exp, Date_Calc::getCalendarWeek(27, 2, 1900), 'getCalendarWeek 1');
$exp = array('20000228', '20000229', '20000301', '20000302', '20000303', '20000304', '20000305');
compare($exp, Date_Calc::getCalendarWeek(28, 2, 2000), 'getCalendarWeek 2');
$exp = array('20001127', '20001128', '20001129', '20001130', '20001201', '20001202', '20001203');
compare($exp, Date_Calc::getCalendarWeek(27, 11, 2000), 'getCalendarWeek 3');
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');