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


PHP Date_Calc::prevDay方法代码示例

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


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

示例1: MAX_getDatesByPeriodLimitStart

function MAX_getDatesByPeriodLimitStart($period, $limit, $start)
{
    $begin = $limit + $start - 1;
    $end = $start;
    switch ($period) {
        case 'daily':
            $dayBegin = new Date();
            $dayBegin->subtractSpan(new Date_Span("{$begin}, 0, 0, 0"));
            $dayEnd = new Date();
            $dayBegin->subtractSpan(new Date_Span("{$end}, 0, 0, 0"));
            break;
        case 'weekly':
            $dayBegin = new Date(Date_Calc::prevDay());
            $dayEnd = new Date(Date_Calc::prevDay());
            break;
        case 'monthly':
            $dayBegin = new Date();
            $dayBegin->subtractSpan(new Date_Span('6, 0, 0, 0'));
            $dayEnd = new Date();
            break;
        case 'allstats':
        default:
            $dayBegin = null;
            $dayEnd = null;
    }
    $aDates = array();
    $aDates['day_begin'] = is_object($dayBegin) ? $dayBegin->format('%Y-%m-%d') : '';
    $aDates['day_end'] = is_object($dayEnd) ? $dayEnd->format('%Y-%m-%d') : '';
    return $aDates;
}
开发者ID:Jaree,项目名称:revive-adserver,代码行数:30,代码来源:stats.php

示例2: getPrevDay

 /**
  * Get a Date object for the day before this one
  *
  * Get a Date object for the day before this one.
  * The time of the returned Date object is the same as this time.
  *
  * @access public
  * @return object Date Date representing the previous day
  */
 function getPrevDay()
 {
     $day = Date_Calc::prevDay($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;
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:17,代码来源:Date.php

示例3: w2p_Utilities_Date

$ctoday = new w2p_Utilities_Date();
$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);
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:day_view.php

示例4: _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

示例5: postcalendar_userapi_buildView


//.........这里部分代码省略.........
        } else {
            $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);
        }
开发者ID:bradymiller,项目名称:openemr,代码行数:67,代码来源:pnuserapi.php

示例6: MakeRecurrences

 public function MakeRecurrences()
 {
     global $_EV_CONF;
     $days_on = $this->event->rec_data['listdays'];
     $occurrence = $this->dt_start;
     $num_intervals = count($days_on);
     $last_interval = $days_on[$num_intervals - 1];
     // Start by reducing the starting date by one day. Then the for
     // loop can handle all the events.
     list($y, $m, $d) = explode('-', $occurrence);
     $occurrence = Date_Calc::prevDay($d, $m, $y);
     $count = 1;
     while ($occurrence <= $this->event->rec_data['stop'] && $occurrence >= '1971-01-01' && $count < $_EV_CONF['max_repeats']) {
         foreach ($days_on as $dow) {
             list($y, $m, $d) = explode('-', $occurrence);
             $occurrence = Date_Calc::nextDayOfWeek($dow - 1, $d, $m, $y);
             // Stop when we hit the stop date
             if ($occurrence > $this->event->rec_data['stop']) {
                 break;
             }
             $this->storeEvent($occurrence);
             $count++;
             if ($count > $_EV_CONF['max_repeats']) {
                 break;
             }
         }
         // foreach days_on
         if ($this->freq > 1) {
             // Get the beginning of this week, and add $freq weeks to it
             $occurrence = Date_Calc::beginOfWeek($d + 7 * $this->freq, $m, $y);
         }
     }
     // while not at stop date
     return $this->events;
 }
开发者ID:matrox66,项目名称:evlist,代码行数:35,代码来源:evRecur.class.php

示例7: compare

compare(5, Date_Calc::weeksInMonth('11', '2000'), 'weeksInMonth str');
$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');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php


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