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


PHP Date_Calc::firstOfMonthWeekday方法代码示例

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


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

示例1: getCalendarMonth

 /**
  * Return a set of arrays to construct a calendar month 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 format for returned date
  *
  * @access public
  *
  * @return array $month[$row][$col]
  */
 function getCalendarMonth($month = "", $year = "", $format = "%Y%m%d")
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow("%Y");
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow("%m");
     }
     $month_array = array();
     // date for the first row, first column of calendar month
     if (DATE_CALC_BEGIN_WEEKDAY == 1) {
         if (Date_Calc::firstOfMonthWeekday($month, $year) == 0) {
             $curr_day = Date_Calc::dateToDays("01", $month, $year) - 6;
         } else {
             $curr_day = Date_Calc::dateToDays("01", $month, $year) - Date_Calc::firstOfMonthWeekday($month, $year) + 1;
         }
     } else {
         $curr_day = Date_Calc::dateToDays("01", $month, $year) - Date_Calc::firstOfMonthWeekday($month, $year);
     }
     // number of days in this month
     $daysInMonth = Date_Calc::daysInMonth($month, $year);
     $weeksInMonth = Date_Calc::weeksInMonth($month, $year);
     for ($row_counter = 0; $row_counter < $weeksInMonth; $row_counter++) {
         for ($column_counter = 0; $column_counter <= 6; $column_counter++) {
             $month_array[$row_counter][$column_counter] = Date_Calc::daysToDate($curr_day, $format);
             $curr_day++;
         }
     }
     return $month_array;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:42,代码来源:Calc.php

示例2: getWeeksInMonth

 /**
  * Returns the number of weeks in the month
  * @param int year (2003)
  * @param int month (9)
  * @param int first day of the week (default: monday)
  * @return int weeks number
  * @access protected
  */
 function getWeeksInMonth($y, $m, $firstDay = 1)
 {
     $FDOM = Date_Calc::firstOfMonthWeekday($m, $y);
     if ($FDOM > $firstDay) {
         $firstWeekDays = $this->getDaysInWeek() - $FDOM + $firstDay;
         $weeks = 1;
     } else {
         $firstWeekDays = $firstDay - $FDOM;
         $weeks = 0;
     }
     $firstWeekDays %= $this->getDaysInWeek();
     $result = (int) (ceil(($this->getDaysInMonth($y, $m) - $firstWeekDays) / $this->getDaysInWeek()) + $weeks);
     if ($FDOM != 0) {
         return $result;
     } else {
         return $result + 1;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phpalmanac-svn,代码行数:26,代码来源:PearDate.php

示例3: lastDateofAllweek

function lastDateofAllweek($Month, $Year)
{
    $date = new Date();
    $Date_Calc = new Date_Calc();
    $date->setYear($Year);
    $date->setMonth($Month);
    $TotalWeek = $date->getWeeksInMonth();
    $daysMonth = $date->getDaysInMonth();
    $i = 1;
    $PassedDays = 0;
    while ($i <= $TotalWeek) {
        if (strlen($PassedDays) == 1) {
            $PassedDays = "0" . $PassedDays;
        }
        if ($i == 1) {
            $fstdayWeek = $Date_Calc->firstOfMonthWeekday($Month, $Year);
            $lastdayWeek = 7 - $fstdayWeek;
            $PassedDays = $lastdayWeek + 1;
            if (strlen($lastdayWeek) == 1) {
                $lastdayWeek = "0" . $lastdayWeek;
            }
            $Lastdate[$i - 1] = $Year . "-" . $Month . "-" . $lastdayWeek;
        } elseif ($i == $TotalWeek) {
            $remainDays = $daysMonth - $PassedDays;
            if (strlen($remainDays) == 1) {
                $remainDays = "0" . $remainDays;
            }
            $curWeekDays += $daysMonth - $curWeekDays;
            $Lastdate[$i - 1] = $Year . "-" . $Month . "-" . $daysMonth;
        } else {
            $PassedDays += 7;
            $lastdayWeek = $PassedDays - 1;
            if (strlen($lastdayWeek) == 1) {
                $lastdayWeek = "0" . $lastdayWeek;
            }
            $Lastdate[$i - 1] = $Year . "-" . $Month . "-" . $lastdayWeek;
        }
        $i++;
    }
    return $Lastdate;
}
开发者ID:hotveryspicy,项目名称:work_sneha,代码行数:41,代码来源:functions.php

示例4: getWeeksInMonth

 /**
  * Returns the number of weeks in the month
  * @param int year (2003)
  * @param int month (9)
  * @param int first day of the week (default: monday)
  * @return int weeks number
  * @access protected
  */
 function getWeeksInMonth($y, $m, $firstDay = 1)
 {
     $FDOM = Date_Calc::firstOfMonthWeekday($m, $y);
     if ($FDOM == 0) {
         $FDOM = $this->getDaysInWeek();
     }
     if ($FDOM > $firstDay) {
         $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
         $weeks = 1;
     } else {
         $daysInTheFirstWeek = $firstDay - $FDOM;
         $weeks = 0;
     }
     $daysInTheFirstWeek %= $this->getDaysInWeek();
     return (int) (ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) / $this->getDaysInWeek()) + $weeks);
 }
开发者ID:BackupTheBerlios,项目名称:wikiplug,代码行数:24,代码来源:PearDate.php

示例5: compare

compare('20010301', Date_Calc::beginOfMonthBySpan(13, 2, 2000), 'beginOfMonthBySpan 10');
compare('20010301', Date_Calc::beginOfMonthBySpan('13', '02', '2000'), 'beginOfMonthBySpan 10 str');
compare('19991031', Date_Calc::endOfMonthBySpan(-13, 11, 2000), 'endOfMonthBySpan 1');
compare('20001031', Date_Calc::endOfMonthBySpan(-1, 11, 2000), 'endOfMonthBySpan 2');
compare('20001130', Date_Calc::endOfMonthBySpan(0, 11, 2000), 'endOfMonthBySpan 3');
compare('20001231', Date_Calc::endOfMonthBySpan(1, 11, 2000), 'endOfMonthBySpan 4');
compare('20011231', Date_Calc::endOfMonthBySpan(13, 11, 2000), 'endOfMonthBySpan 5');
compare('19990131', Date_Calc::endOfMonthBySpan('-13', '02', '2000'), 'endOfMonthBySpan 6 str');
compare('19990131', Date_Calc::endOfMonthBySpan(-13, 2, 2000), 'endOfMonthBySpan 6');
compare('20000131', Date_Calc::endOfMonthBySpan(-1, 2, 2000), 'endOfMonthBySpan 7');
compare('20000229', Date_Calc::endOfMonthBySpan(0, 2, 2000), 'endOfMonthBySpan 8');
compare('20000331', Date_Calc::endOfMonthBySpan(1, 2, 2000), 'endOfMonthBySpan 9');
compare('20010331', Date_Calc::endOfMonthBySpan(13, 2, 2000), 'endOfMonthBySpan 10');
compare('20010331', Date_Calc::endOfMonthBySpan('13', '02', '2000'), 'endOfMonthBySpan 10 str');
compare(3, Date_Calc::firstOfMonthWeekday(11, 2000), 'firstOfMonthWeekday');
compare(3, Date_Calc::firstOfMonthWeekday('11', '2000'), 'firstOfMonthWeekday str');
compare('20050101', Date_Calc::NWeekdayOfMonth(1, 6, 1, 2005), 'NWeekdayOfMonth 161');
compare('20050102', Date_Calc::NWeekdayOfMonth(1, 0, 1, 2005), 'NWeekdayOfMonth 101');
compare('20050103', Date_Calc::NWeekdayOfMonth(1, 1, 1, 2005), 'NWeekdayOfMonth 111');
compare('20050104', Date_Calc::NWeekdayOfMonth(1, 2, 1, 2005), 'NWeekdayOfMonth 121');
compare('20050105', Date_Calc::NWeekdayOfMonth(1, 3, 1, 2005), 'NWeekdayOfMonth 131');
compare('20050106', Date_Calc::NWeekdayOfMonth(1, 4, 1, 2005), 'NWeekdayOfMonth 141');
compare('20050107', Date_Calc::NWeekdayOfMonth(1, 5, 1, 2005), 'NWeekdayOfMonth 151');
compare('20050108', Date_Calc::NWeekdayOfMonth('2', '6', '01', '2005'), 'NWeekdayOfMonth 261');
compare('20050109', Date_Calc::NWeekdayOfMonth('2', '0', '01', '2005'), 'NWeekdayOfMonth 201');
compare('20050110', Date_Calc::NWeekdayOfMonth('2', '1', '01', '2005'), 'NWeekdayOfMonth 211');
compare('20050111', Date_Calc::NWeekdayOfMonth('2', '2', '01', '2005'), 'NWeekdayOfMonth 221');
compare('20050112', Date_Calc::NWeekdayOfMonth('2', '3', '01', '2005'), 'NWeekdayOfMonth 231');
compare('20050113', Date_Calc::NWeekdayOfMonth('2', '4', '01', '2005'), 'NWeekdayOfMonth 241');
compare('20050114', Date_Calc::NWeekdayOfMonth('2', '5', '01', '2005'), 'NWeekdayOfMonth 251');
compare('20050131', Date_Calc::NWeekdayOfMonth('last', 1, 1, 2005), 'NWeekdayOfMonth l11');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php


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