本文整理汇总了PHP中Date_Calc::dateNow方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::dateNow方法的具体用法?PHP Date_Calc::dateNow怎么用?PHP Date_Calc::dateNow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::dateNow方法的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: dateSeason
/**
* Determines julian date of the given season
* Adapted from previous work in Java by James Mark Hamilton, mhamilton@qwest.net
*
* @author Robert Butler <rob@maxwellcreek.org>
*
* @param string is VERNALEQUINOX, SUMMERSOLSTICE, AUTUMNALEQUINOX, or WINTERSOLSTICE.
* @param string year in format CCYY, must be a calendar year between -1000BC and 3000AD.
*
* @access public
*
* @return float $juliandate
*/
function dateSeason($season, $year = '')
{
if ($year == '') {
$year = Date_Calc::dateNow('%Y');
}
if ($year >= -1000 && $year <= 1000) {
$y = $year / 1000.0;
if ($season == "VERNALEQUINOX") {
$juliandate = (((-0.00071 * $y - 0.00111) * $y + 0.06134) * $y + 365242.1374) * $y + 1721139.29189;
} else {
if ($season == "SUMMERSOLSTICE") {
$juliandate = (((0.00025 * $y + 0.00907) * $y - 0.05323) * $y + 365241.72562) * $y + 1721233.25401;
} else {
if ($season == "AUTUMNALEQUINOX") {
$juliandate = (((0.00074 * $y - 0.00297) * $y - 0.11677) * $y + 365242.49558) * $y + 1721325.70455;
} else {
if ($season == "WINTERSOLSTICE") {
$juliandate = (((-6.0E-5 * $y - 0.00933) * $y - 0.00769) * $y + 365242.88257) * $y + 1721414.39987;
}
}
}
}
} elseif ($year > 1000 && $year <= 3000) {
$y = ($year - 2000) / 1000;
if ($season == "VERNALEQUINOX") {
$juliandate = (((-0.00057 * $y - 0.00411) * $y + 0.05169) * $y + 365242.37404) * $y + 2451623.80984;
} else {
if ($season == "SUMMERSOLSTICE") {
$juliandate = (((-0.0003 * $y + 0.008880000000000001) * $y + 0.00325) * $y + 365241.62603) * $y + 2451716.56767;
} else {
if ($season == "AUTUMNALEQUINOX") {
$juliandate = (((0.00078 * $y + 0.00337) * $y - 0.11575) * $y + 365242.01767) * $y + 2451810.21715;
} else {
if ($season == "WINTERSOLSTICE") {
$juliandate = (((0.00032 * $y - 0.008229999999999999) * $y - 0.06223) * $y + 365242.74049) * $y + 2451900.05952;
}
}
}
}
}
return $juliandate;
}
示例3: isPastDate
/**
* Determines if given date is a past date from now
*
* @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.
*
* @return boolean
* @access public
* @static
*/
function isPastDate($day, $month, $year)
{
$this_year = Date_Calc::dateNow('%Y');
$this_month = Date_Calc::dateNow('%m');
$this_day = Date_Calc::dateNow('%d');
if ($year < $this_year) {
return true;
} elseif ($year == $this_year) {
if ($month < $this_month) {
return true;
} elseif ($month == $this_month) {
if ($day < $this_day) {
return true;
}
}
}
return false;
}
示例4: extract
/**
* postcalendar_userapi_pcQueryEvents
* INPUT
* $args = Array of values possibly containing:
* $provider_id = array of provider ID numbers
*
* Returns an array containing the event's information
* @params array(key=>value)
* @params string key eventstatus
* @params int value -1 == hidden ; 0 == queued ; 1 == approved
* @return array $events[][]
*/
function &postcalendar_userapi_pcQueryEvents($args)
{
$end = '0000-00-00';
extract($args);
// echo "<!-- args = "; print_r($args); echo " -->\n"; // debugging
// $pc_username = pnVarCleanFromInput('pc_username');
$pc_username = $_SESSION['pc_username'];
// from Michael Brinson 2006-09-19
if (empty($pc_username) || is_array($pc_username)) {
$pc_username = "__PC_ALL__";
}
//echo "DEBUG pc_username: $pc_username \n"; // debugging
$topic = pnVarCleanFromInput('pc_topic');
$category = pnVarCleanFromInput('pc_category');
if (!empty($pc_username) && strtolower($pc_username) != 'anonymous') {
if ($pc_username == '__PC_ALL__' || $pc_username == -1) {
$ruserid = -1;
} else {
$ruserid = getIDfromUser($pc_username);
}
}
if (!isset($eventstatus)) {
$eventstatus = 1;
}
// sanity check on eventstatus
if ((int) $eventstatus < -1 || (int) $eventstatus > 1) {
$eventstatus = 1;
}
if (!isset($start)) {
$start = Date_Calc::dateNow('%Y-%m-%d');
}
list($sy, $sm, $sd) = explode('-', $start);
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// link to the events tables
$table = $pntable['postcalendar_events'];
$cattable = $pntable['postcalendar_categories'];
$topictable = $pntable['postcalendar_topics'];
$sql = "SELECT DISTINCT a.pc_eid, a.pc_informant, a.pc_catid, " . "a.pc_title, a.pc_time, a.pc_hometext, a.pc_eventDate, a.pc_duration, " . "a.pc_endDate, a.pc_startTime, a.pc_recurrtype, a.pc_recurrfreq, " . "a.pc_recurrspec, a.pc_topic, a.pc_alldayevent, a.pc_location, " . "a.pc_conttel, a.pc_contname, a.pc_contemail, a.pc_website, a.pc_fee, " . "a.pc_sharing, a.pc_prefcatid, b.pc_catcolor, b.pc_catname, " . "b.pc_catdesc, a.pc_pid, a.pc_apptstatus, a.pc_aid, " . "concat(u.fname,' ',u.lname) as provider_name, " . "concat(pd.lname,', ',pd.fname) as patient_name, " . "concat(u2.fname, ' ', u2.lname) as owner_name, " . "DOB as patient_dob, a.pc_facility, pd.pubpid " . "FROM ( {$table} AS a ) " . "LEFT JOIN {$cattable} AS b ON b.pc_catid = a.pc_catid " . "LEFT JOIN users as u ON a.pc_aid = u.id " . "LEFT JOIN users as u2 ON a.pc_aid = u2.id " . "LEFT JOIN patient_data as pd ON a.pc_pid = pd.pid " . "WHERE a.pc_eventstatus = {$eventstatus} " . "AND ((a.pc_endDate >= '{$start}' AND a.pc_eventDate <= '{$end}') OR " . "(a.pc_endDate = '0000-00-00' AND a.pc_eventDate >= '{$start}' AND " . "a.pc_eventDate <= '{$end}')) ";
//==================================
//FACILITY FILTERING (lemonsoftware)(CHEMED)
if ($_SESSION['pc_facility']) {
$pc_facility = $_SESSION['pc_facility'];
$sql .= " AND a.pc_facility = {$pc_facility} ";
/*
AND u.facility_id = $pc_facility
AND u2.facility_id = $pc_facility "; */
} else {
if ($pc_facility) {
// pc_facility could be provided in the search arguments -- JRM March 2008
$sql .= " AND a.pc_facility = {$pc_facility} ";
/*.
" AND u.facility_id = $pc_facility".
" AND u2.facility_id = $pc_facility "; */
}
}
//EOS FACILITY FILTERING (lemonsoftware)
//==================================
// The above 3 lines replaced these:
// AND (a.pc_endDate >= '$start' OR a.pc_endDate = '0000-00-00')
// AND a.pc_eventDate <= '$end' ";
if (!empty($providerID)) {
$ruserid = $providerID;
}
// eliminate ruserid if we're trying to query by provider_id -- JRM
if (!empty($provider_id)) {
unset($ruserid);
}
if (isset($ruserid)) {
// get all events for the specified username
if ($ruserid == -1) {
$sql .= "AND (a.pc_sharing = '" . SHARING_BUSY . "' ";
$sql .= "OR a.pc_sharing = '" . SHARING_PUBLIC . "') ";
} else {
$sql .= "AND a.pc_aid IN (0, " . $ruserid . ") ";
}
} elseif (!pnUserLoggedIn()) {
// get all events for anonymous users
$sql .= "AND a.pc_sharing = '" . SHARING_GLOBAL . "' ";
} elseif (!empty($provider_id)) {
// get all events for a variety of provider IDs -- JRM
if ($provider_id[0] != "_ALL_") {
/**add all the events from the clinic provider id = 0*/
$sql .= "AND a.pc_aid in (0," . implode(",", $provider_id) . ") ";
}
} else {
// get all events for logged in user plus global events
$sql .= "AND (a.pc_aid IN (0," . $_SESSION['authUserID'] . ") OR a.pc_sharing = '" . SHARING_GLOBAL . "') ";
//.........这里部分代码省略.........
示例5: 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);
}
示例6: generateTable
/**
* Generate the HTML_Table object of the calendar
*
* @param day day of the calendar to generate, null = today's day
* @param month month of the calendar to generate, null = today's month
* @param year year of the calendar to generate, null = today's year
*
* @access public
* @return the HTML_Table object of the calendar
*/
function generateTable($day = null, $month = null, $year = null)
{
if (empty($year)) {
$year = Date_Calc::dateNow('%Y');
}
if (empty($month)) {
$month = Date_Calc::dateNow('%m');
}
if (empty($day)) {
$day = Date_Calc::dateNow('%d');
}
$year = sprintf('%04d', $year);
$month = sprintf('%02d', $month);
$day = sprintf('%02d', $day);
// get month structure for generating calendar
$month_cal = Date_Calc::getCalendarMonth($month, $year, '%E');
$this->_todayDays = Date_Calc::dateFormat(null, null, null, '%E');
$this->_thisMonth = Date_Calc::dateFormat($day, $month, $year, '%m');
$row = 0;
$table = new HTML_Table($this->_attributes['table']);
$table->addRow(array($this->drawTitle($day, $month, $year)));
$table->setRowAttributes($row, $this->_attributes['title']);
$row++;
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawWeekDayText($col), 'TH');
}
$table->setRowAttributes($row++, $this->_attributes['weekday']);
for ($week = 0; $week < count($month_cal); $week++) {
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawCell($month_cal[$week][$col], $week, $col));
$type = $this->getType($month_cal[$week][$col]);
$table->setCellAttributes($row, $col, $this->_attributes['cell']);
$table->updateCellAttributes($row, $col, $this->_attributes['cell_' . $type]);
}
$row++;
}
return $table;
}
示例7: compare
if (php_sapi_name() != 'cli') {
echo "<pre>\n";
}
compare('20001122', Date_Calc::dateFormat(22, 11, 2000, '%Y%m%d'), 'dateFormat');
compare('20001122', Date_Calc::dateFormat('22', '11', '2000', '%Y%m%d'), 'dateFormat str');
compare('2001', Date_Calc::defaultCentury('1'), 'defaultCentury 1 str');
compare('2001', Date_Calc::defaultCentury(1), 'defaultCentury 1');
compare('1960', Date_Calc::defaultCentury(60), 'defaultCentury 2');
compare('2010', Date_Calc::defaultCentury(10), 'defaultCentury 3');
compare(2451871, Date_Calc::dateToDays('22', '11', '2000'), 'dateToDays str');
compare(2451871, Date_Calc::dateToDays(22, 11, 2000), 'dateToDays');
compare('20001122', Date_Calc::daysToDate(2451871), 'daysToDate');
compare('2000-47-3', Date_Calc::gregorianToISO('22', '11', '2000'), 'gregorianToISO str');
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');