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


PHP Date_Calc::getMonthNames方法代码示例

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


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

示例1: getMonthFromFullName

 /**
  * Returns the numeric month from the month name or an abreviation
  *
  * Both August and Aug would return 8.
  * Month name is case insensitive.
  *
  * @param    string  month name
  * @return   integer month number
  */
 function getMonthFromFullName($month)
 {
     $month = strtolower($month);
     $months = Date_Calc::getMonthNames();
     while (list($id, $name) = each($months)) {
         if (ereg($month, strtolower($name))) {
             return $id;
         }
     }
     return 0;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:20,代码来源:Calc.php

示例2: format2


//.........这里部分代码省略.........
                 $i += 1 + strlen($hs_numberformat);
                 break;
             case "m":
                 $hb_lower = true;
             case "M":
                 if (strtoupper(substr($ps_format, $i, 2)) == "MI") {
                     if ($this->ob_invalidtime) {
                         return $this->_getErrorInvalidTime();
                     }
                     $hs_numberformat = substr($ps_format, $i + 2, 4);
                     $hs_minute = $this->_formatNumber($this->minute, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
                     if (Pear::isError($hs_minute)) {
                         return $hs_minute;
                     }
                     $ret .= $hs_minute;
                     $i += 2 + strlen($hs_numberformat);
                 } else {
                     if (strtoupper(substr($ps_format, $i, 2)) == "MM") {
                         $hs_numberformat = substr($ps_format, $i + 2, 4);
                         $hs_month = $this->_formatNumber($this->month, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
                         if (Pear::isError($hs_month)) {
                             return $hs_month;
                         }
                         $ret .= $hs_month;
                         $i += 2 + strlen($hs_numberformat);
                     } else {
                         if (strtoupper(substr($ps_format, $i, 5)) == "MONTH") {
                             $hs_month = Date_Calc::getMonthFullname($this->month);
                             if (!$hb_nopad) {
                                 if (is_null($hn_monthpad)) {
                                     // Set month padding variable:
                                     //
                                     $hn_monthpad = 0;
                                     foreach (Date_Calc::getMonthNames() as $hs_monthofyear) {
                                         $hn_monthpad = max($hn_monthpad, strlen($hs_monthofyear));
                                     }
                                 }
                                 $hs_month = str_pad($hs_month, $hn_monthpad, " ", STR_PAD_RIGHT);
                             }
                             $ret .= $hb_lower ? strtolower($hs_month) : (substr($ps_format, $i + 1, 1) == "O" ? strtoupper($hs_month) : $hs_month);
                             $i += 5;
                         } else {
                             if (strtoupper(substr($ps_format, $i, 3)) == "MON") {
                                 $hs_month = Date_Calc::getMonthAbbrname($this->month);
                                 $ret .= $hb_lower ? strtolower($hs_month) : (substr($ps_format, $i + 1, 1) == "O" ? strtoupper($hs_month) : $hs_month);
                                 $i += 3;
                             }
                         }
                     }
                 }
                 break;
             case "n":
             case "N":
                 // No-Padding rule 'NP' applies to the next code (either trailing
                 // spaces or leading/trailing noughts):
                 //
                 $hb_nopadflag = true;
                 $i += 2;
                 break;
             case "p":
                 $hb_lower = true;
             case "P":
                 if ($this->ob_invalidtime) {
                     return $this->_getErrorInvalidTime();
                 }
                 if (strtoupper(substr($ps_format, $i, 4)) == "P.M.") {
开发者ID:,项目名称:,代码行数:67,代码来源:

示例3: getMonthFromFullName

 /**
  * Returns the numeric month from the month name or an abreviation
  *
  * Both August and Aug would return 8.
  * Month name is case insensitive.
  *
  * @param    string  month name
  * @return   integer month number
  */
 function getMonthFromFullName($month)
 {
     $month = strtolower($month);
     $months = Date_Calc::getMonthNames();
     while (list($id, $name) = each($months)) {
         if (strpos(strtolower($name), $month) !== false) {
             return $id;
         }
     }
     return 0;
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:20,代码来源:Calc.php

示例4: getMonthFromFullName

 /**
  * Returns the numeric month from the month name or an abreviation
  *
  * Both August and Aug would return 8.
  * Month name is case insensitive.
  *
  * @param    string  month name
  * @return   integer month number
  */
 static function getMonthFromFullName($month)
 {
     $month = strtolower($month);
     $months = Date_Calc::getMonthNames();
     while (list($id, $name) = each($months)) {
         if (preg_match("/" . addcslashes($month, '/') . "/", strtolower($name))) {
             return $id;
         }
     }
     return 0;
 }
开发者ID:juggernautsei,项目名称:openemr,代码行数:20,代码来源:Calc.php

示例5: compare

compare(date('Y'), Date_Calc::getYear(), 'getYear');
compare(date('m'), Date_Calc::getMonth(), 'getMonth');
compare(date('d'), Date_Calc::getDay(), 'getDay');
compare(327, Date_Calc::dayOfYear(22, 11, 2000), 'dayOfYear');
compare('November', Date_Calc::getMonthFullname(11), 'getMonthFullname');
compare('Nov', Date_Calc::getMonthAbbrname(11), 'getMonthAbbrname');
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');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php

示例6: getMonthFullname

 /**
  * Returns the full month name for the given month
  *
  * @param int    $month   the month
  *
  * @return string  the full name of the month
  *
  * @access public
  * @static
  */
 function getMonthFullname($month)
 {
     $month = (int) $month;
     if (empty($month)) {
         $month = (int) Date_Calc::dateNow('%m');
     }
     $month_names = Date_Calc::getMonthNames();
     return $month_names[$month];
 }
开发者ID:sugan2111,项目名称:Drupal_code,代码行数:19,代码来源:Calc.php


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