本文整理汇总了PHP中Date_Calc::getWeekDays方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::getWeekDays方法的具体用法?PHP Date_Calc::getWeekDays怎么用?PHP Date_Calc::getWeekDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::getWeekDays方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWeekdayAbbrname
/**
* Returns the abbreviated weekday name for the given date
*
* @param int $pn_day the day of the month, default is current local day
* @param int $pn_month the month, default is current local month
* @param int $pn_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($pn_day = 0, $pn_month = 0, $pn_year = null, $length = 3)
{
if (is_null($pn_year)) {
$pn_year = Date_Calc::dateNow('%Y');
}
if (empty($pn_month)) {
$pn_month = Date_Calc::dateNow('%m');
}
if (empty($pn_day)) {
$pn_day = Date_Calc::dateNow('%d');
}
$weekday_names = Date_Calc::getWeekDays(true);
$weekday = Date_Calc::dayOfWeek($pn_day, $pn_month, $pn_year);
return $weekday_names[$weekday];
}
示例2: 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];
}
示例3: getWeekdayFullname
/**
* Returns the full 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
*
* @return string the full name of the day of the week
*
* @access public
* @static
*/
function getWeekdayFullname($day = 0, $month = 0, $year = 0)
{
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];
}
示例4: format2
//.........这里部分代码省略.........
} else {
// Code C(CCC...):
//
$hn_codelen = 1;
while (strtoupper(substr($ps_format, $i + $hn_codelen, 1)) == "C") {
++$hn_codelen;
}
// Check next code is not 'CE' or 'C.E.'
//
if ($hn_codelen > 1 && (strtoupper(substr($ps_format, $i + $hn_codelen - 1, 4)) == "C.E." || strtoupper(substr($ps_format, $i + $hn_codelen - 1, 2)) == "CE")) {
--$hn_codelen;
}
$hn_century = intval($this->year / 100);
$hs_numberformat = substr($ps_format, $i + $hn_codelen, 4);
$hs_century = $this->_formatNumber($hn_century, $hs_numberformat, $hn_codelen, $hb_nopad, $hb_nosign, $ps_locale);
if (Pear::isError($hs_century)) {
return $hs_century;
}
$ret .= $hs_century;
$i += $hn_codelen + strlen($hs_numberformat);
}
}
break;
case "d":
$hb_lower = true;
case "D":
if (strtoupper(substr($ps_format, $i, 3)) == "DAY") {
$hs_day = Date_Calc::getWeekdayFullname($this->day, $this->month, $this->year);
if (!$hb_nopad) {
if (is_null($hn_weekdaypad)) {
// Set week-day padding variable:
//
$hn_weekdaypad = 0;
foreach (Date_Calc::getWeekDays() as $hs_weekday) {
$hn_weekdaypad = max($hn_weekdaypad, strlen($hs_weekday));
}
}
$hs_day = str_pad($hs_day, $hn_weekdaypad, " ", STR_PAD_RIGHT);
}
$ret .= $hb_lower ? strtolower($hs_day) : (substr($ps_format, $i + 1, 1) == "A" ? strtoupper($hs_day) : $hs_day);
$i += 3;
} else {
if (strtoupper(substr($ps_format, $i, 2)) == "DY") {
$hs_day = Date_Calc::getWeekdayAbbrname($this->day, $this->month, $this->year);
$ret .= $hb_lower ? strtolower($hs_day) : (substr($ps_format, $i + 1, 1) == "Y" ? strtoupper($hs_day) : $hs_day);
$i += 2;
} else {
if (strtoupper(substr($ps_format, $i, 3)) == "DDD" && strtoupper(substr($ps_format, $i + 2, 3)) != "DAY" && strtoupper(substr($ps_format, $i + 2, 2)) != "DY") {
$hn_day = Date_Calc::dayOfYear($this->day, $this->month, $this->year);
$hs_numberformat = substr($ps_format, $i + 3, 4);
$hs_day = $this->_formatNumber($hn_day, $hs_numberformat, 3, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_day)) {
return $hs_day;
}
$ret .= $hs_day;
$i += 3 + strlen($hs_numberformat);
} else {
if (strtoupper(substr($ps_format, $i, 2)) == "DD" && strtoupper(substr($ps_format, $i + 1, 3)) != "DAY" && strtoupper(substr($ps_format, $i + 1, 2)) != "DY") {
$hs_numberformat = substr($ps_format, $i + 2, 4);
$hs_day = $this->_formatNumber($this->day, $hs_numberformat, 2, $hb_nopad, true, $ps_locale);
if (Pear::isError($hs_day)) {
return $hs_day;
}
$ret .= $hs_day;
$i += 2 + strlen($hs_numberformat);
} else {
示例5: Edit
//.........这里部分代码省略.........
$T->set_var('listdays_val', COM_stripslashes($rec_data[0]));
if (is_array($this->rec_data['listdays']) && !empty($this->rec_data['listdays'])) {
foreach ($this->rec_data['listdays'] as $day) {
$day = (int) $day;
if ($day > 0 && $day < 8) {
$T->set_var('daychk' . $day, EVCHECKED);
}
}
}
break;
case EV_RECUR_DOM:
$recweekday = $this->rec_data['weekday'];
break;
case EV_RECUR_DATES:
$T->set_var(array('stopshow' => 'style="display:none;"', 'custom_val' => implode(',', $this->rec_data['custom'])));
break;
}
$start1 = EVLIST_TimeSelect('start1', $this->time_start1);
$start2 = EVLIST_TimeSelect('start2', $this->time_start2);
$end1 = EVLIST_TimeSelect('end1', $this->time_end1);
$end2 = EVLIST_TimeSelect('end2', $this->time_end2);
$cal_select = COM_optionList($_TABLES['evlist_calendars'], 'cal_id,cal_name', $this->cal_id, 1, 'cal_status = 1 ' . COM_getPermSQL('AND', 0, 2));
USES_class_navbar();
$navbar = new navbar();
$cnt = 0;
foreach ($tabs as $id) {
$navbar->add_menuitem($LANG_EVLIST[$id], 'showhideEventDiv("' . $id . '",' . $cnt . ');return false;', true);
$cnt++;
}
$navbar->set_selected($LANG_EVLIST['ev_info']);
if ($this->AdminMode) {
$action_url .= '?admin=true';
}
$T->set_var(array('action_url' => $action_url, 'navbar' => $navbar->generate(), 'alert_msg' => $alert_msg, 'cancel_url' => $cancel_url, 'eid' => $this->id, 'rp_id' => $rp_id, 'title' => $this->Detail->title, 'summary' => $summary, 'description' => $full_description, 'location' => $location, 'status_checked' => $this->status == 1 ? EVCHECKED : '', 'url' => $this->Detail->url, 'street' => $this->Detail->street, 'city' => $this->Detail->city, 'province' => $this->Detail->province, 'country' => $this->Detail->country, 'postal' => $this->Detail->postal, 'contact' => $this->Detail->contact, 'email' => $this->Detail->email, 'phone' => $this->Detail->phone, 'startdate1' => $this->date_start1, 'enddate1' => $this->date_end1, 'd_startdate1' => EVLIST_formattedDate($this->date_start1), 'd_enddate1' => EVLIST_formattedDate($this->date_end1), 'start_hour_options1' => $start1['hour'], 'start_minute_options1' => $start1['minute'], 'startdate1_ampm' => $start1['ampm'], 'end_hour_options1' => $end1['hour'], 'end_minute_options1' => $end1['minute'], 'enddate1_ampm' => $end1['ampm'], 'start_hour_options2' => $start2['hour'], 'start_minute_options2' => $start2['minute'], 'startdate2_ampm' => $start2['ampm'], 'end_hour_options2' => $end2['hour'], 'end_minute_options2' => $end2['minute'], 'enddate2_ampm' => $end2['ampm'], 'recurring_format_options' => EVLIST_GetOptions($LANG_EVLIST['rec_formats'], $option), 'recurring_weekday_options' => EVLIST_GetOptions(Date_Calc::getWeekDays(), $recweekday, 1), 'dailystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['day_by_date'], ''), 'monthlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'yearlystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year'], $LANG_EVLIST['if_any']), 'listdays_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['days_of_week'], ''), 'listdaystop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['date_l'], $LANG_EVLIST['if_any']), 'intervalstop_label' => sprintf($LANG_EVLIST['stop_label'], $LANG_EVLIST['year_and_month'], $LANG_EVLIST['if_any']), 'custom_label' => sprintf($LANG_EVLIST['custom_label'], $LANG_EVLIST['dates'], ''), 'datestart_note' => $LANG_EVLIST['datestart_note'], 'src' => isset($_GET['src']) && $_GET['src'] == 'a' ? '1' : '0', 'rem_status_checked' => $this->enable_reminders == 1 ? EVCHECKED : '', 'del_button' => $this->id == '' ? '' : 'true', 'saveaction' => $saveaction, 'delaction' => $delaction, 'owner_id' => $this->owner_id, 'enable_reminders' => $_EV_CONF['enable_reminders'], 'iso_lang' => EVLIST_getIsoLang(), 'hour_mode' => $_CONF['hour_mode'], 'days_interval' => $days_interval, 'display_format' => $_CONF['shortdate'], 'ts_start' => strtotime($this->date_start1), 'ts_end' => strtotime($this->date_end1), 'cal_select' => $cal_select, 'contactlink_chk' => $this->options['contactlink'] == 1 ? EVCHECKED : '', 'lat' => $this->Detail->lat, 'lng' => $this->Detail->lng, 'perm_msg' => $LANG_ACCESS['permmsg'], 'last' => $LANG_EVLIST['rec_intervals'][5], 'doc_url' => EVLIST_getDocURL('event.html'), 'mootools' => $_SYSTEM['disable_mootools'] ? '' : 'true'));
if ($_EV_CONF['enable_rsvp']) {
USES_evlist_class_tickettype();
$TickTypes = evTicketType::GetTicketTypes();
//$T->set_block('editor', 'Tickets', 'tTypes');
$tick_opts = '';
foreach ($TickTypes as $tick_id => $tick_obj) {
// Check enabled tickets. Ticket type 1 enabled by default
if (isset($this->options['tickets'][$tick_id]) || $tick_id == 1) {
$checked = 'checked="checked"';
$fee = (double) $this->options['tickets'][$tick_id]['fee'];
} else {
$checked = '';
$fee = 0;
}
$tick_opts .= '<tr><td><input name="tickets[' . $tick_id . ']" type="checkbox" ' . $checked . ' value="' . $tick_id . '" /></td>' . '<td>' . $tick_obj->description . '</td>' . '<td><input type="text" name="tick_fees[' . $tick_id . ']" value="' . $fee . '" size="8" /></td></tr>' . LB;
/*$T->set_var(array(
'tick_id' => $tic['id'],
'tick_desc' => $tic['description'],
'tick_fee' => $fee,
'tick_enabled' => $enabled ? 'checked="checked"' : '',
) ) ;
//$T->parse('tTypes', 'Tickets', true);*/
}
if ($_EV_CONF['rsvp_print'] > 0) {
$rsvp_print_chk = 'rsvp_print_chk' . $this->options['rsvp_print'];
$rsvp_print = 'true';
} else {
$rsvp_print = '';
$rsvp_print_chk = 'no_rsvp_print';
}
$T->set_var(array('enable_rsvp' => 'true', 'reg_chk' . $this->options['use_rsvp'] => EVCHECKED, 'rsvp_wait_chk' => $this->options['rsvp_waitlist'] == 1 ? EVCHECKED : '', 'max_rsvp' => $this->options['max_rsvp'], 'max_user_rsvp' => $this->options['max_user_rsvp'], 'rsvp_cutoff' => $this->options['rsvp_cutoff'], 'use_rsvp' => $this->options['use_rsvp'], 'rsvp_waitlist' => $this->options['rsvp_waitlist'], 'tick_opts' => $tick_opts, 'rsvp_print' => $rsvp_print, $rsvp_print_chk => 'checked="checked"'));
}
示例6: fbHTML_Calendar
/**
* Constructor.
*
* @param int
* HTML_CALENDAR_FULL: Full calendar, days are not links
* HTML_CALENDAR_TINY: Tiny calendar, days are links
*
* @access public
*/
function fbHTML_Calendar($size = HTML_CALENDAR_FULL, $path = null)
{
global $_SERVER;
// < 4.1.0
$this->setSize($size);
$this->setPath(isset($path) ? $path : $_SERVER['PHP_SELF']);
$this->_weekDays = Date_Calc::getWeekDays();
if (DATE_CALC_BEGIN_WEEKDAY == 1) {
array_push($this->_weekDays, array_shift($this->_weekDays));
}
}
示例7: compare
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');
compare(29, Date_Calc::daysInMonth('02', 2000), 'daysInMonth 3 str');
compare(28, Date_Calc::daysInMonth('02', 2001), 'daysInMonth 4 str');