本文整理汇总了PHP中Date_Calc::getWeekdayFullname方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::getWeekdayFullname方法的具体用法?PHP Date_Calc::getWeekdayFullname怎么用?PHP Date_Calc::getWeekdayFullname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::getWeekdayFullname方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
* @see Date_Calc::getWeekdayFullname
*/
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");
}
return substr(Date_Calc::getWeekdayFullname($day, $month, $year), 0, $length);
}
示例2: getDayName
/**
* Gets the full name or abbriviated name of this weekday
*
* Gets the full name or abbriviated name of this weekday
*
* @access public
* @param boolean $abbr abbrivate the name
* @return string name of this day
*/
function getDayName($abbr = false, $length = 3)
{
if ($abbr) {
return Date_Calc::getWeekdayAbbrname($this->day, $this->month, $this->year, $length);
} else {
return Date_Calc::getWeekdayFullname($this->day, $this->month, $this->year);
}
}
示例3: dateFormat
/**
* Formats the date in the given format, much like strfmt()
*
* This function is used to alleviate the problem with 32-bit numbers for
* dates pre 1970 or post 2038, as strfmt() has on most systems.
* Most of the formatting options are compatible.
*
* Formatting options:
* <pre>
* %a abbreviated weekday name (Sun, Mon, Tue)
* %A full weekday name (Sunday, Monday, Tuesday)
* %b abbreviated month name (Jan, Feb, Mar)
* %B full month name (January, February, March)
* %d day of month (range 00 to 31)
* %e day of month, single digit (range 0 to 31)
* %E number of days since unspecified epoch (integer)
* (%E is useful for passing a date in a URL as
* an integer value. Then simply use
* daysToDate() to convert back to a date.)
* %j day of year (range 001 to 366)
* %m month as decimal number (range 1 to 12)
* %n newline character (\n)
* %t tab character (\t)
* %w weekday as decimal (0 = Sunday)
* %U week number of current year, first sunday as first week
* %y year as decimal (range 00 to 99)
* %Y year as decimal including century (range 0000 to 9999)
* %% literal '%'
* </pre>
*
* @param int $day the day of the month
* @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 format string
*
* @return string the date in the desired format
* @access public
* @static
*/
function dateFormat($day, $month, $year, $format)
{
if (!Date_Calc::isValidDate($day, $month, $year)) {
$year = Date_Calc::dateNow('%Y');
$month = Date_Calc::dateNow('%m');
$day = Date_Calc::dateNow('%d');
}
$output = '';
for ($strpos = 0; $strpos < strlen($format); $strpos++) {
$char = substr($format, $strpos, 1);
if ($char == '%') {
$nextchar = substr($format, $strpos + 1, 1);
switch ($nextchar) {
case 'a':
$output .= Date_Calc::getWeekdayAbbrname($day, $month, $year);
break;
case 'A':
$output .= Date_Calc::getWeekdayFullname($day, $month, $year);
break;
case 'b':
$output .= Date_Calc::getMonthAbbrname($month);
break;
case 'B':
$output .= Date_Calc::getMonthFullname($month);
break;
case 'd':
$output .= sprintf('%02d', $day);
break;
case 'e':
$output .= $day;
break;
case 'E':
$output .= Date_Calc::dateToDays($day, $month, $year);
break;
case 'j':
$output .= Date_Calc::dayOfYear($day, $month, $year);
break;
case 'm':
$output .= sprintf('%02d', $month);
break;
case 'n':
$output .= "\n";
break;
case 't':
$output .= "\t";
break;
case 'w':
$output .= Date_Calc::dayOfWeek($day, $month, $year);
break;
case 'U':
$output .= Date_Calc::weekOfYear($day, $month, $year);
break;
case 'y':
$output .= sprintf('%0' . ($year < 0 ? '3' : '2') . 'd', $year % 100);
break;
case "Y":
$output .= sprintf('%0' . ($year < 0 ? '5' : '4') . 'd', $year);
break;
case '%':
$output .= '%';
//.........这里部分代码省略.........
示例4: getWeekdayAbbrname
/**
* Returns the abbreviated weekday name for the given date
*
* @param int $day the day of the month, default is current local day
* @param int $month the month, default is current local month
* @param int $year the year in four digit format, default is current local year
* @param int $length the length of abbreviation
*
* @return string the abbreviated name of the day of the week
*
* @access public
* @static
* @see Date_Calc::getWeekdayFullname()
*/
function getWeekdayAbbrname($day = 0, $month = 0, $year = 0, $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');
}
return substr(Date_Calc::getWeekdayFullname($day, $month, $year), 0, $length);
}
示例5: dateFormat
/**
* Formats the date in the given format, much like
* strfmt(). This function is used to alleviate the
* problem with 32-bit numbers for dates pre 1970
* or post 2038, as strfmt() has on most systems.
* Most of the formatting options are compatible.
*
* formatting options:
*
* %a abbreviated weekday name (Sun, Mon, Tue)
* %A full weekday name (Sunday, Monday, Tuesday)
* %b abbreviated month name (Jan, Feb, Mar)
* %B full month name (January, February, March)
* %d day of month (range 00 to 31)
* %e day of month, single digit (range 0 to 31)
* %E number of days since unspecified epoch (integer)
* (%E is useful for passing a date in a URL as
* an integer value. Then simply use
* daysToDate() to convert back to a date.)
* %j day of year (range 001 to 366)
* %m month as decimal number (range 1 to 12)
* %n newline character (\n)
* %t tab character (\t)
* %w weekday as decimal (0 = Sunday)
* %U week number of current year, first sunday as first week
* %y year as decimal (range 00 to 99)
* %Y year as decimal including century (range 0000 to 9999)
* %% literal '%'
*
* @param string year in format CCYY
* @param string month in format MM
* @param string day in format DD
* @param string format for returned date
*
* @access public
*
* @return string date in given format
*/
function dateFormat($day, $month, $year, $format)
{
if (!Date_Calc::isValidDate($day, $month, $year)) {
$year = Date_Calc::dateNow("%Y");
$month = Date_Calc::dateNow("%m");
$day = Date_Calc::dateNow("%d");
}
$output = "";
for ($strpos = 0; $strpos < strlen($format); $strpos++) {
$char = substr($format, $strpos, 1);
if ($char == "%") {
$nextchar = substr($format, $strpos + 1, 1);
switch ($nextchar) {
case "a":
$output .= Date_Calc::getWeekdayAbbrname($day, $month, $year);
break;
case "A":
$output .= Date_Calc::getWeekdayFullname($day, $month, $year);
break;
case "b":
$output .= Date_Calc::getMonthAbbrname($month);
break;
case "B":
$output .= Date_Calc::getMonthFullname($month);
break;
case "d":
$output .= sprintf("%02d", $day);
break;
case "e":
$output .= $day;
break;
case "E":
$output .= Date_Calc::dateToDays($day, $month, $year);
break;
case "j":
$output .= Date_Calc::julianDate($day, $month, $year);
break;
case "m":
$output .= sprintf("%02d", $month);
break;
case "n":
$output .= "\n";
break;
case "t":
$output .= "\t";
break;
case "w":
$output .= Date_Calc::dayOfWeek($day, $month, $year);
break;
case "U":
$output .= Date_Calc::weekOfYear($day, $month, $year);
break;
case "y":
$output .= substr($year, 2, 2);
break;
case "Y":
$output .= $year;
break;
case "%":
$output .= "%";
break;
default:
//.........这里部分代码省略.........
示例6: get_relative_day
/**
* Get the new day for a relative time period
*
* This method is super important for the monthly
* recurrence because it supports what I call the
* "relative" days of the month. A relative day
* is "1st monday" or "2nd to last friday". This
* is different from the (easier to compute) absolute
* days like "the 4th" or "the 23rd". This method
* handles the relative days compution in a pretty
* simple way.
*
* An array of all the days in the month is sent
* to the method. A for loop runs through each one
* of these days and turns the particular day (1st,
* 2nd, 3rd, etc) into it's weekday equivalent (Monday,
* Tuesday, Wednesday, etc).
*
* For a "first" day, the first match of the given
* weekday (Monday, Tuesday, etc) is returned.
*
* For a "second" day, a simple counter is used. When
* the particular weekday is stumbled upon, the counter
* is incremented. When the counter reaches the appropriate
* relative day, that day of the month (1st, 2nd, 3rd) is
* returned, and the PEAR Date class is set to use that
* new day.
*
* By adjusting the "future" object, I can use the built
* "after" or "before" methods to compare two PEAR Date
* objects
*
* @param array $days_in_month The days of a given month
* where the values of the array are 1,2,3...31
* up to however many days are in the month
* @param integer $future_month The month of the "future"
* date (date being checked to see if today's date
* has passed it)
* @param integer $future_year The year of the "future"
* date.
* @param string $weekday The fullname of the weekday being
* checked for. "Monday", "Tuesday", etc.
* @param integer The number of weekdays that must be found
* before the day of the month will be returned.
* @return integer Day of the month for the relative day
*/
private function get_relative_day($days_in_month, $future_month, $future_year, $weekday, $count_to = 0)
{
$needed_count = 0;
foreach ($days_in_month as $key => $day) {
$check_day = Date_Calc::getWeekdayFullname($day, $future_month, $future_year);
if ($check_day == $weekday) {
if ($count_to > 0) {
$needed_count++;
if ($needed_count == $count_to) {
break;
}
} else {
break;
}
}
}
return $day;
}
示例7: compare
compare('2000-47-3', Date_Calc::gregorianToISO(22, 11, 2000), 'gregorianToISO');
compare(2451716.56767, Date_Calc::dateSeason('SUMMERSOLSTICE', 2000), 'dateSeason');
compare(date('Ymd'), Date_Calc::dateNow(), 'dateNow');
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');