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


PHP Date_Calc::dayOfWeek方法代码示例

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


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

示例1: getDayOfWeek

 /**
  * Gets the day of the week for this date
  *
  * Gets the day of the week for this date (0=Sunday)
  *
  * @access public
  * @return int the day of the week (0=Sunday)
  */
 function getDayOfWeek()
 {
     return Date_Calc::dayOfWeek($this->day, $this->month, $this->year);
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:12,代码来源:Date.php

示例2: nextDayName

 /**
  * Returns textual representation of the next day of week of the decorated calendar object
  * @param object subclass of Calendar e.g. Calendar_Month
  * @param string (optional) format of returned months (one,two,short or long)
  * @return string
  * @access public
  * @static
  */
 function nextDayName($Calendar, $format = 'long')
 {
     $days = Calendar_Util_Textual::weekdayNames($format);
     $stamp = $Calendar->nextDay('timestamp');
     $cE = $Calendar->getEngine();
     require_once 'Date/Calc.php';
     $day = Date_Calc::dayOfWeek($cE->stampToDay($stamp), $cE->stampToMonth($stamp), $cE->stampToYear($stamp));
     return $days[$day];
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:17,代码来源:Textual.php

示例3: getWeekdayFullname

 /**
  * Returns the full weekday name for the given date
  *
  * @param string year in format CCYY, default current local year
  * @param string month in format MM, default current local month
  * @param string day in format DD, default current local day
  *
  * @access public
  *
  * @return string full month name
  */
 function getWeekdayFullname($day = "", $month = "", $year = "")
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow("%Y");
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow("%m");
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow("%d");
     }
     $weekday_names = Date_Calc::getWeekDays();
     $weekday = Date_Calc::dayOfWeek($day, $month, $year);
     return $weekday_names[$weekday];
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:26,代码来源:Calc.php

示例4: nWeekdayOfMonth

 /**
  * Calculates the date of the Nth weekday of the month,
  * such as the second Saturday of January 2000
  *
  * @param int    $week   the number of the week to get
  *                        (1 = first, etc.  Also can be 'last'.)
  * @param int    $dow    the day of the week (0 = Sunday)
  * @param int    $month  the month
  * @param int    $year   the year.  Use the complete year instead of the
  *                        abbreviated version.  E.g. use 2005, not 05.
  * @param string $format the string indicating how to format the output
  *
  * @return   string     the date in the desired format
  * @access   public
  * @static
  */
 function nWeekdayOfMonth($week, $dow, $month, $year, $format = DATE_CALC_FORMAT)
 {
     if (is_numeric($week)) {
         $DOW1day = ($week - 1) * 7 + 1;
         $DOW1 = Date_Calc::dayOfWeek($DOW1day, $month, $year);
         $wdate = ($week - 1) * 7 + 1 + (7 + $dow - $DOW1) % 7;
         if ($wdate > Date_Calc::daysInMonth($month, $year)) {
             return -1;
         } else {
             return Date_Calc::dateFormat($wdate, $month, $year, $format);
         }
     } elseif ($week == 'last' && $dow < 7) {
         $lastday = Date_Calc::daysInMonth($month, $year);
         $lastdow = Date_Calc::dayOfWeek($lastday, $month, $year);
         $diff = $dow - $lastdow;
         if ($diff > 0) {
             return Date_Calc::dateFormat($lastday - (7 - $diff), $month, $year, $format);
         } else {
             return Date_Calc::dateFormat($lastday + $diff, $month, $year, $format);
         }
     } else {
         return -1;
     }
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:40,代码来源:Calc.php

示例5: getDayOfWeek

 /**
  * Returns the number of the day of the week (0=sunday, 1=monday...)
  * @param int year (2003)
  * @param int month (9)
  * @param int day (4)
  * @return int weekday number
  * @access protected
  */
 function getDayOfWeek($y, $m, $d)
 {
     return Date_Calc::dayOfWeek($d, $m, $y);
 }
开发者ID:BackupTheBerlios,项目名称:phpalmanac-svn,代码行数:12,代码来源:PearDate.php

示例6: EVLIST_dayview

/**
*   Display a single-day calendar view.
*
*   @param  integer $year   Year to display, default is current year
*   @param  integer $month  Starting month
*   @param  integer $day    Starting day
*   @param  integer $cat    Category to show
*   @param  integer $cal    Calendar to show
*   @return string          HTML for calendar page
*/
function EVLIST_dayview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
    global $_CONF, $_EV_CONF, $LANG_EVLIST;
    USES_class_date();
    EVLIST_setViewSession('day', $year, $month, $day);
    $retval = '';
    list($currentyear, $currentmonth, $currentday) = explode('-', $_EV_CONF['_today']);
    // Default to the current day
    if ($year == 0) {
        $year = $currentyear;
    }
    if ($month == 0) {
        $month = $currentmonth;
    }
    if ($day == 0) {
        $day = $currentday;
    }
    $cat = (int) $cat;
    $cal = (int) $cal;
    $today = sprintf("%04d-%02d-%02d", $year, $month, $day);
    $dtToday = new Date(strtotime($today), $_CONF['timezone']);
    $dtPrev = new Date($dtToday->toUnix() - 86400, $_CONF['timezone']);
    $dtNext = new Date($dtToday->toUnix() + 86400, $_CONF['timezone']);
    $monthname = $LANG_MONTH[$month];
    $dow = Date_Calc::dayOfWeek($day, $month, $year) + 1;
    $dayname = $dtToday->format('l');
    $tpl = 'dayview';
    if ($opt == 'print') {
        $tpl .= '_print';
    } elseif ($_EV_CONF['cal_tmpl'] == 'json') {
        $tpl .= '_json';
    }
    $T = new Template(EVLIST_PI_PATH . '/templates/dayview');
    $T->set_file(array('column' => 'column.thtml', 'event' => 'singleevent.thtml', 'dayview' => $tpl . '.thtml'));
    $events = EVLIST_getEvents($today, $today, array('cat' => $cat, 'cal' => $cal));
    $calendars_used = array();
    list($allday, $hourly) = EVLIST_getDayViewData($events, $starting_date);
    // Get allday events
    $alldaycount = count($allday);
    if ($alldaycount > 0) {
        for ($i = 1; $i <= $alldaycount; $i++) {
            $A = current($allday);
            $calendars_used[$A['cal_id']] = array('cal_name' => $A['cal_name'], 'cal_ena_ical' => $A['cal_ena_ical'], 'cal_id' => $A['cal_id'], 'fgcolor' => $A['fgcolor'], 'bgcolor' => $A['bgcolor']);
            $T->set_var(array('delete_imagelink' => EVLIST_deleteImageLink($A, $token), 'event_time' => $LANG_EVLIST['allday'], 'rp_id' => $A['rp_id'], 'event_title' => stripslashes($A['title']), 'event_summary' => stripslashes($A['summary']), 'bgcolor' => $A['bgcolor'], 'fgcolor' => $A['fgcolor'], 'cal_id' => $A['cal_id']));
            if ($i < $alldaycount) {
                $T->set_var('br', '<br />');
            } else {
                $T->set_var('br', '');
            }
            $T->parse('allday_events', 'event', true);
            next($allday);
        }
    } else {
        $T->set_var('allday_events', '&nbsp;');
    }
    for ($i = 0; $i < 24; $i++) {
        $link = date($_CONF['timeonly'], mktime($i, 0));
        if ($_EV_CONF['_can_add']) {
            $link = '<a href="' . EVLIST_URL . '/event.php?edit=x&amp;month=' . $month . '&amp;day=' . $day . '&amp;year=' . $year . '&amp;hour=' . $i . '">' . $link . '</a>';
        }
        $T->set_var($i . '_hour', $link);
    }
    // Get hourly events
    /*$times = array();
      foreach ($hourly as $event) {
          if (!isset($times[$event['starthour']]))
              $times[$event['starthour']] = array();
          $times[$event['starthour']][] = $event;
      }*/
    for ($i = 0; $i <= 23; $i++) {
        $hourevents = $hourly[$i];
        $numevents = count($hourevents);
        if ($numevents > 0) {
            for ($j = 1; $j <= $numevents; $j++) {
                $A = current($hourevents);
                $calendars_used[$A['data']['cal_id']] = array('cal_name' => $A['data']['cal_name'], 'cal_ena_ical' => $A['data']['cal_ena_ical'], 'cal_id' => $A['data']['cal_id'], 'fgcolor' => $A['data']['fgcolor'], 'bgcolor' => $A['data']['bgcolor']);
                if ($A['data']['rp_date_start'] == $starting_date) {
                    $start_time = date($_CONF['timeonly'], strtotime($A['data']['rp_date_start'] . ' ' . $A['time_start']));
                    //strtotime($A['evt_start'] . ' ' . $A['timestart']));
                } else {
                    $start_time = date($_CONF['shortdate'] . ' @ ' . $_CONF['timeonly'], strtotime($A['data']['rp_date_start'] . ' ' . $A['time_start']));
                }
                if ($A['data']['rp_date_end'] == $_EV_CONF['today']) {
                    $end_time = date($_CONF['timeonly'], strtotime($A['data']['rp_date_end'] . ' ' . $A['time_end']));
                } else {
                    $end_time = date($_CONF['shortdate'] . ' @ ' . $_CONF['timeonly'], strtotime($A['data']['rp_date_end'] . ' ' . $A['time_end']));
                }
                if ($start_time == ' ... ' && $end_time == ' ... ') {
                    $T->set_var('event_time', $LANG_EVLIST['allday']);
                } else {
//.........这里部分代码省略.........
开发者ID:matrox66,项目名称:evlist,代码行数:101,代码来源:evlist_views.inc.php

示例7: getWeekdayFullname

 /**
  * Returns the full weekday name for the given date
  *
  * @param string day in format DD, default is current local day
  * @param string month in format MM, default is current local month
  * @param string year in format CCYY, default is current local year
  *
  * @access public
  *
  * @return string full month name
  */
 function getWeekdayFullname($day = '', $month = '', $year = '')
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     $weekday_names = Date_Calc::getWeekDays();
     $weekday = Date_Calc::dayOfWeek($day, $month, $year);
     return $weekday_names[$weekday];
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:26,代码来源:Calc.php

示例8: getWeekdayAbbrname

 /**
  * Returns the abbreviated weekday name for the given date
  *
  * @param string year in format CCYY, default current local year
  * @param string month in format MM, default current local month
  * @param string day in format DD, default current local day
  * @param int optional length of abbreviation, default is 3
  *
  * @access public
  *
  * @return string full month name
  */
 function getWeekdayAbbrname($day = "", $month = "", $year = "", $length = 3)
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow("%Y");
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow("%m");
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow("%d");
     }
     $weekday_names = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
     $weekday = Date_Calc::dayOfWeek($day, $month, $year);
     return substr($weekday_names[$weekday], 0, $length);
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:27,代码来源:Calc.php

示例9: 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;
 }
开发者ID:matrox66,项目名称:evlist,代码行数:23,代码来源:evRecur.class.php

示例10: compare

compare('Saturday', Date_Calc::getWeekdayFullname(1, 1, 2005), 'getWeekdayFullname');
compare('Sat', Date_Calc::getWeekdayAbbrname(1, 1, 2005), 'getWeekdayAbbrname');
compare(11, Date_Calc::getMonthFromFullName('November'), 'getMonthFromFullName');
compare(327, Date_Calc::dayOfYear('22', '11', '2000'), 'dayOfYear str');
compare('November', Date_Calc::getMonthFullname('11'), 'getMonthFullname str');
compare('Nov', Date_Calc::getMonthAbbrname('11'), 'getMonthAbbrname str');
compare('Saturday', Date_Calc::getWeekdayFullname('01', '01', '2005'), 'getWeekdayFullname str');
compare('Sat', Date_Calc::getWeekdayAbbrname('01', '01', '2005'), 'getWeekdayAbbrname str');
$exp = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
compare($exp, Date_Calc::getMonthNames(), 'getMonthNames');
$exp = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
compare($exp, Date_Calc::getWeekDays(), 'getWeekDays');
compare(3, Date_Calc::dayOfWeek(22, 11, 2000), 'dayOfWeek');
compare(47, Date_Calc::weekOfYear(22, 11, 2000), 'weekOfYear');
compare(4, Date_Calc::quarterOfYear(22, 11, 2000), 'quarterOfYear');
compare(3, Date_Calc::dayOfWeek('22', '11', '2000'), 'dayOfWeek str');
compare(47, Date_Calc::weekOfYear('22', '11', '2000'), 'weekOfYear str');
compare(4, Date_Calc::quarterOfYear('22', '11', '2000'), 'quarterOfYear str');
compare(28, Date_Calc::daysInMonth(2, 1900), 'daysInMonth 1');
compare(29, Date_Calc::daysInMonth(2, 1996), 'daysInMonth 2');
compare(29, Date_Calc::daysInMonth(2, 2000), 'daysInMonth 3');
compare(28, Date_Calc::daysInMonth(2, 2001), 'daysInMonth 4');
compare(30, Date_Calc::daysInMonth(11, 2000), 'daysInMonth 5');
compare(28, Date_Calc::daysInMonth('02', 1900), 'daysInMonth 1 str');
compare(29, Date_Calc::daysInMonth('02', 1996), 'daysInMonth 2 str');
compare(29, Date_Calc::daysInMonth('02', 2000), 'daysInMonth 3 str');
compare(28, Date_Calc::daysInMonth('02', 2001), 'daysInMonth 4 str');
compare(30, Date_Calc::daysInMonth('11', '2000'), 'daysInMonth 5 str');
compare(5, Date_Calc::weeksInMonth(11, 2000), 'weeksInMonth');
compare(5, Date_Calc::weeksInMonth('11', '2000'), 'weeksInMonth str');
$exp = array('19000226', '19000227', '19000228', '19000301', '19000302', '19000303', '19000304');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php

示例11: isoWeekToDate

 /**
  * Converts the Week number and Day-of-Week to Date
  *
  * Calculation algorithm taken from
  * {@link http://www.merlyn.demon.co.uk/weekcalc.htm}.
  *
  * @param int    $dow    day of week from 1 (Monday) to 7 (Sunday)
  * @param int    $week   number of week from 1 to 53
  * @param int    $year   four digits of year
  * @param string $format the output format
  *
  * @return  string formatted date
  * @access  public
  * @static
  * @since   Method available since Release 1.5.0a2
  */
 function isoWeekToDate($dow, $week, $year, $format = DATE_CALC_FORMAT)
 {
     // validates the week number
     list(, $nweeks) = Date_Calc::isoWeekDate(28, 12, $year);
     if ($week > $nweeks) {
         return PEAR::raiseError("ISO week number for {$year} cannot be greater than {$nweeks}", DATE_ERROR_INVALIDDATE);
     }
     // validates the day of week
     if ($dow < 1 || $dow > 7) {
         return PEAR::raiseError("ISO day of week must be between 1 and 7", DATE_ERROR_INVALIDDATE);
     }
     // finds the day of week of January 4th.
     $jan4th = Date_Calc::dayOfWeek(4, 1, $year);
     if ($jan4th == 0) {
         $jan4th = 7;
     }
     // offset to the monday of that week
     $offset = -($jan4th - 1);
     // increment the days starting from january 4th.
     $days = Date_Calc::dateToDays(1, 1, $year) + $offset + 7 * ($week - 1) + ($dow - 1) + 3;
     return Date_Calc::daysToDate($days, $format);
 }
开发者ID:milk54,项目名称:geeklog-japan,代码行数:38,代码来源:Calc.php

示例12: postcalendar_upgrade


//.........这里部分代码省略.........
                        $recurrspec['event_repeat_on_day'] = 0;
                        $recurrspec['event_repeat_on_freq'] = 0;
                        break;
                    case _EVENT_DAILY:
                        $recurrtype = REPEAT;
                        $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                        $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_DAY;
                        $recurrspec['event_repeat_on_num'] = 0;
                        $recurrspec['event_repeat_on_day'] = 0;
                        $recurrspec['event_repeat_on_freq'] = 0;
                        break;
                    case _EVENT_WEEKLY:
                        $recurrtype = REPEAT;
                        $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                        $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_WEEK;
                        $recurrspec['event_repeat_on_num'] = 0;
                        $recurrspec['event_repeat_on_day'] = 0;
                        $recurrspec['event_repeat_on_freq'] = 0;
                        break;
                    case _EVENT_MONTHLY:
                        if ($rfreq == _RECUR_SAME_DATE) {
                            $recurrtype = REPEAT;
                            $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                            $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_MONTH;
                            $recurrspec['event_repeat_on_num'] = 0;
                            $recurrspec['event_repeat_on_day'] = 0;
                            $recurrspec['event_repeat_on_freq'] = 0;
                        } elseif ($rfreq == _RECUR_SAME_DAY) {
                            $recurrtype = REPEAT_ON;
                            list($y, $m, $d) = explode('-', $eventdate);
                            $recurrspec['event_repeat_freq'] = 0;
                            $recurrspec['event_repeat_freq_type'] = 0;
                            // event day of week
                            $edow = Date_Calc::dayOfWeek($d, $m, $y);
                            // date of first event day of week
                            $firstDay = Date_Calc::NWeekdayOfMonth(1, $edow, $m, $y, '%Y-%m-%d');
                            // find difference between 1st day and event day
                            list($y2, $m2, $d2) = explode('-', $firstDay);
                            $diff = Date_Calc::dateDiff($d, $m, $y, $d2, $m2, $y2);
                            // assuming $diff is going to be a multiple of 7
                            if ($diff > 0) {
                                $diff /= 7;
                            }
                            if ($diff > REPEAT_ON_4TH) {
                                $diff = REPEAT_ON_LAST;
                            }
                            $recurrspec['event_repeat_on_num'] = $diff;
                            $recurrspec['event_repeat_on_day'] = $edow;
                            $recurrspec['event_repeat_on_freq'] = REPEAT_ON_MONTH;
                        }
                        break;
                    case _EVENT_YEARLY:
                        if ($rfreq == _RECUR_SAME_DATE) {
                            $recurrtype = REPEAT;
                            $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                            $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_YEAR;
                            $recurrspec['event_repeat_on_num'] = 0;
                            $recurrspec['event_repeat_on_day'] = 0;
                            $recurrspec['event_repeat_on_freq'] = 0;
                        } elseif ($rfreq == _RECUR_SAME_DAY) {
                            $recurrtype = REPEAT_ON;
                            list($y, $m, $d) = explode('-', $eventdate);
                            $recurrspec['event_repeat_freq'] = 0;
                            $recurrspec['event_repeat_freq_type'] = 0;
                            // event day of week
                            $edow = Date_Calc::dayOfWeek($d, $m, $y);
开发者ID:katopenzz,项目名称:openemr,代码行数:67,代码来源:pninit.php


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