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


PHP parse_date函数代码示例

本文整理汇总了PHP中parse_date函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_date函数的具体用法?PHP parse_date怎么用?PHP parse_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: api_getConstituencies_date

function api_getConstituencies_date($date) {
	if ($date = parse_date($date)) {
		api_getConstituencies('"' . $date['iso'] . '"');
	} else {
		api_error('Invalid date format');
	}
}
开发者ID:henare,项目名称:theyworkforyou,代码行数:7,代码来源:api_getConstituencies.php

示例2: api_getMembers_date

function api_getMembers_date($house, $date) {
	if ($date = parse_date($date)) {
		api_getMembers($house, '"' . $date['iso'] . '"');
	} else {
		api_error('Invalid date format');
	}
}
开发者ID:rhaleblian,项目名称:twfy,代码行数:7,代码来源:api_getMembers.php

示例3: getArgs

 public function getArgs()
 {
     $args = array();
     if (get_http_var('f') == 'csv') {
         $args['f'] = 'csv';
     }
     $date = get_http_var('date');
     if ($date) {
         $date = parse_date($date);
         if ($date) {
             $args['date'] = $date['iso'];
         }
     } elseif (get_http_var('all')) {
         $args['all'] = true;
     }
     if ($this->type == 'peers') {
         $args['order'] = 'name';
     }
     $order = get_http_var('o');
     $orders = array('n' => 'name', 'f' => 'given_name', 'l' => 'family_name', 'c' => 'constituency', 'p' => 'party', 'd' => 'debates');
     if (array_key_exists($order, $orders)) {
         $args['order'] = $orders[$order];
     }
     return $args;
 }
开发者ID:vijo,项目名称:theyworkforyou,代码行数:25,代码来源:People.php

示例4: api_getCommittee_name

function api_getCommittee_name($name) {
	$db = new ParlDB;

	$name = preg_replace('#\s+Committee#', '', $name);

	$date = parse_date(get_http_var('date'));
	if ($date) $date = '"' . $date['iso'] . '"';
	else $date = 'date(now())';
	$q = $db->query("select distinct(dept) from moffice
		where dept like '%" . mysql_real_escape_string($name) . "%Committee'
		and from_date <= " . $date . ' and '
		. $date . ' <= to_date');
	if ($q->rows() > 1) {
		# More than one committee matches
		for ($i=0; $i<$q->rows(); $i++) {
			$output['committees'][] = array(
				'name' => $q->field($i, 'dept')
			);
		}
		api_output($output);
	} elseif ($q->rows()) {
		# One committee
		$q = $db->query("select * from moffice,member
			where moffice.person = member.person_id
			and dept like '%" . mysql_real_escape_string($name) . "%Committee'
			and from_date <= " . $date . ' and ' . $date . " <= to_date
			and entered_house <= " . $date . ' and ' . $date . ' <= left_house');
		if ($q->rows()) {
			$output = array();
			$output['committee'] = $q->field(0, 'dept');
			for ($i=0; $i<$q->rows(); $i++) {
				$member = array(
'person_id' => $q->field($i, 'person'),
'name' => $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name'),
				);
				if ($q->field($i, 'position') == 'Chairman') {
					$member['position'] = $q->field($i, 'position');
				}
				$output['members'][] = $member;
			}
			api_output($output);
		} else {
			api_error('That committee has no members...?');
		}
	} else {
		api_error('That name was not recognised');
	}
}
开发者ID:henare,项目名称:theyworkforyou,代码行数:48,代码来源:api_getCommittee.php

示例5: parse_date_params

 private function parse_date_params()
 {
     $searchstring = '';
     if (get_http_var('from') || get_http_var('to')) {
         $from = parse_date(get_http_var('from'));
         if ($from) {
             $from = $from['iso'];
         } else {
             $from = '1935-10-01';
         }
         $to = parse_date(get_http_var('to'));
         if ($to) {
             $to = $to['iso'];
         } else {
             $to = date('Y-m-d');
         }
         $searchstring .= " {$from}..{$to}";
     }
     return $searchstring;
 }
开发者ID:vijo,项目名称:theyworkforyou,代码行数:20,代码来源:ParseArgs.php

示例6: create_unit

function create_unit($data)
{
    $fields = array('unit_number', 'element', 'rarity', 'cost', 'hit_count', 'bb_hits', 'sbb_hits', 'bb_fill', 'sbb_fill', 'lord_hp', 'lord_atk', 'lord_def', 'lord_rec', 'anima_hp', 'anima_atk', 'anima_def', 'anima_rec', 'breaker_hp', 'breaker_atk', 'breaker_def', 'breaker_rec', 'guardian_hp', 'guardian_atk', 'guardian_def', 'guardian_rec', 'oracle_hp', 'oracle_atk', 'oracle_def', 'oracle_rec', 'leaders_skill_effect', 'brave_burst_effect', 'super_brave_burst_effect');
    $type = 'unit';
    $valid_type = function_exists('post_type_exists') && post_type_exists($type);
    if (!$valid_type) {
        //$this->log['error']["type-{$type}"] = sprintf('Unknown post type "%s".', $type);
    }
    $new_post = array('post_title' => convert_chars($data['unit_name']), 'post_content' => 'Not available', 'post_status' => 'publish', 'post_type' => $type, 'post_date' => parse_date(time()));
    // create!
    $id = wp_insert_post($new_post);
    //Now that we have a new post ID update the associated field data
    foreach ($fields as $field) {
        if (array_key_exists($field, $data)) {
            update_field($field, $data[$field], $id);
        } else {
            return "<b>The field {$field} does not exist.</b>";
        }
    }
    return $id;
}
开发者ID:boyd109,项目名称:BraveBlank,代码行数:21,代码来源:unit_import_model.php

示例7: list_reps

function list_reps($type, $rep_plural, $search_sidebar)
{
    global $this_page, $PAGE, $DATA;
    $this_page = $type;
    $args = array();
    if ($type == 'peers') {
        $args['order'] = 'name';
    }
    $date = get_http_var('date');
    if ($date) {
        $date = parse_date($date);
        if ($date) {
            $DATA->set_page_metadata($this_page, 'title', $rep_plural . ', as on ' . format_date($date['iso'], LONGDATEFORMAT));
            $args['date'] = $date['iso'];
        }
    } elseif (get_http_var('all')) {
        $DATA->set_page_metadata($this_page, 'title', 'All ' . $rep_plural . ', including former ones');
        $args['all'] = true;
    } else {
        $DATA->set_page_metadata($this_page, 'title', 'All ' . $rep_plural);
    }
    if (get_http_var('f') != 'csv') {
        $PAGE->page_start();
        $PAGE->stripe_start();
        $format = 'html';
    } else {
        $format = 'csv';
    }
    $order = get_http_var('o');
    $orders = array('n' => 'name', 'f' => 'given_name', 'l' => 'family_name', 'c' => 'constituency', 'p' => 'party', 'd' => 'debates');
    if (array_key_exists($order, $orders)) {
        $args['order'] = $orders[$order];
    }
    $PEOPLE = new PEOPLE();
    $PEOPLE->display($type, $args, $format);
    if (get_http_var('f') != 'csv') {
        $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'minisurvey'), array('type' => 'include', 'content' => 'people'), array('type' => 'include', 'content' => $search_sidebar)));
        $PAGE->page_end();
    }
}
开发者ID:udp12,项目名称:theyworkforyou,代码行数:40,代码来源:index.php

示例8: Request

     // Update the 'approved' property
     $req = new Request();
     $approved = empty($_POST['approved']) ? 'false' : 'true';
     $query = 'UPDATE request SET approved=' . $approved . ' WHERE id=' . $_POST['rid'];
     $req->query($query);
     // What's the id of the person this job is assigned to?
     $user = new Users();
     $user->fullname = $_POST['assign_to'];
     $user->find();
     $aid = $user->uid;
     // Insert the new assignment
     $asn = new Assign();
     $asn->rid = $_POST['rid'];
     $asn->hours = $_POST['hours'];
     $asn->cost = str_replace('$', '', $_POST['cost']);
     $asn->complete = parse_date($_POST);
     $asn->aid = $aid;
     $asn->insert();
     header('Location: index.php');
 }
 // Initialize values!
 $name = '';
 $phone = '';
 $year = '';
 $month = '';
 $day = '';
 $desc = '';
 $checked = '';
 $id = isset($_GET['id']) ? $_GET['id'] : null;
 if ($id) {
     $req = new Request();
开发者ID:nk53,项目名称:Job-Ticket,代码行数:31,代码来源:Assign.php

示例9: Get_summary_list

 public static function Get_summary_list($account1_id, $account2_id, $start_date, $end_date, &$summary_list)
 {
     $summary_list = array();
     $error = '';
     // VALIDATE
     $start_time = parse_date($start_date);
     $end_time = parse_date($end_date);
     if ($start_time == -1) {
         return 'Start date is invalid';
     } elseif ($end_time == -1) {
         return 'End date is invalid';
     }
     $start_date_sql = date('Y-m-d', $start_time);
     $end_date_sql = date('Y-m-d', $end_time);
     // Query the normal balance of the selected accounts
     $sql = "SELECT a.account_id, a.account_debit " . "FROM Accounts a \n" . "WHERE account_id IN (:account1_id, :account2_id) ";
     $pdo = db_connect_pdo();
     $ps = $pdo->prepare($sql);
     $ps->bindParam(':account1_id', $account1_id);
     $ps->bindParam(':account2_id', $account2_id);
     $success = $ps->execute();
     if (!$success) {
         return get_pdo_error($ps);
     }
     $account1_debit = 1;
     $account2_debit = 1;
     while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
         if ($row['account_id'] == $account1_id) {
             $account1_debit = $row['account_debit'];
         } elseif ($row['account_id'] == $account2_id) {
             $account2_debit = $row['account_debit'];
         }
     }
     // SQL statement: group the summary by month & year (once per account)
     for ($i = 0; $i < 2; $i++) {
         $group_sql = "month(t.accounting_date), year(t.accounting_date) ";
         $month_sql = "month(t.accounting_date) as accounting_month, ";
         if ($i == 0 || $i == 2) {
             $account_id = $account1_id;
             $account_debit = $account1_debit;
         } elseif ($i == 1 || $i == 3) {
             $account_id = $account2_id;
             $account_debit = $account2_debit;
         }
         if ($i == 2 || $i == 3) {
             // yearly summary
             $group_sql = "year(t.accounting_date) \n";
             // count as month 13, as this sorts after december
             $month_sql = "13 as accounting_month, ";
         }
         $sql = "SELECT sum(ledger_amount * a.account_debit * :account_debit) " . "  as account_sum, {$month_sql} " . "  year(t.accounting_date) as accounting_year \n" . "FROM Transactions t \n" . "INNER JOIN Ledger_Entries le on le.trans_id = t.trans_id \n" . "INNER JOIN Accounts a on a.account_id = le.account_id \n" . "LEFT JOIN Accounts a2 on a.account_parent_id = a2.account_id \n" . "WHERE (a.account_id = :account_id OR " . "  a2.account_id = :account_id OR " . "  a2.account_parent_id = :account_id) " . "  and t.accounting_date >= :start_date_sql " . "  and t.accounting_date <= :end_date_sql \n" . "GROUP BY {$group_sql} \n" . "ORDER BY year(accounting_date) ASC, month(accounting_date) ASC ";
         $ps = $pdo->prepare($sql);
         $ps->bindParam(':account_debit', $account_debit);
         $ps->bindParam(':account_id', $account_id);
         $ps->bindParam(':start_date_sql', $start_date_sql);
         $ps->bindParam(':end_date_sql', $end_date_sql);
         $success = $ps->execute();
         if (!$success) {
             return get_pdo_error($ps);
         }
         $ytd_total = 0;
         $last_key = '';
         $last_year = 0;
         // (YYYY-MM) => (month, year, account1_sum, account2_sum)
         while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
             $summary_year = $row['accounting_year'];
             if ($summary_year != $last_year) {
                 // new year; reset the YTD totals
                 $ytd_total = 0;
             }
             $summary_month = $row['accounting_month'];
             $summary_month = str_pad($summary_month, 2, '0', STR_PAD_LEFT);
             $key = $summary_year . '-' . $summary_month;
             $ytd_total += $row['account_sum'];
             if ($i == 0 || $i == 2) {
                 // account 1 query (always a new list item)
                 $summary_list[$key] = array((int) $summary_month, $summary_year, $row['account_sum'], 0, $ytd_total, 0);
                 if ($last_key != '') {
                     // for account YTD, when not on first row,
                     // grab last month's value as default.
                     // This is in case this month has no data;
                     // the YTD should still stay the same.
                     //						$summary_list[$key][3] =
                     //							$summary_list[$last_key][3];
                     //						$summary_list[$key][5] =
                     //							$summary_list[$last_key][5];
                 }
             } else {
                 // account2: check for existing list item
                 if (array_key_exists($key, $summary_list)) {
                     $summary_list[$key][3] = $row['account_sum'];
                     $summary_list[$key][5] = $ytd_total;
                 } else {
                     // no existing data for this month
                     $summary_list[$key] = array((int) $summary_month, $summary_year, 0, $row['account_sum'], 0, $ytd_total);
                 }
             }
             $last_key = $key;
             $last_year = $summary_year;
         }
//.........这里部分代码省略.........
开发者ID:fedoracooper,项目名称:cooper-accounting-php,代码行数:101,代码来源:accountClass.php

示例10: process_csv

function process_csv($filename, $override_imports, $override_expiry, $separator = ',', $quote = '"')
{
    $sql = e107::getDb();
    $pref['ban_durations'] = e107::getPref('ban_durations');
    $mes = e107::getMessage();
    //  echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote}  override imports: {$override_imports}  override expiry: {$override_expiry}<br />";
    // Renumber imported bans
    if ($override_imports) {
        $sql->db_Update('banlist', "`banlist_bantype`=" . eIPHandler::BAN_TYPE_TEMPORARY . " WHERE `banlist_bantype` = " . eIPHandler::BAN_TYPE_IMPORTED);
    }
    $temp = file($filename);
    $line_num = 0;
    foreach ($temp as $line) {
        // Process one entry
        $line = trim($line);
        $line_num++;
        if ($line) {
            $fields = explode($separator, $line);
            $field_num = 0;
            $field_list = array('banlist_bantype' => eIPHandler::BAN_TYPE_IMPORTED);
            foreach ($fields as $f) {
                $f = trim($f);
                if (substr($f, 0, 1) == $quote) {
                    if (substr($f, -1, 1) == $quote) {
                        // Strip quotes
                        $f = substr($f, 1, -1);
                        // Strip off the quotes
                    } else {
                        $mes->addError(BANLAN_49 . $line_num);
                        return BANLAN_49 . $line_num;
                    }
                }
                // Now handle the field
                $field_num++;
                switch ($field_num) {
                    case 1:
                        // IP address
                        $field_list['banlist_ip'] = e107::getIPHandler()->ipEncode($f);
                        break;
                    case 2:
                        // Original date of ban
                        $field_list['banlist_datestamp'] = parse_date($f);
                        break;
                    case 3:
                        // Expiry of ban - depends on $override_expiry
                        if ($override_expiry) {
                            $field_list['banlist_banexpires'] = parse_date($f);
                        } else {
                            // Use default ban time from now
                            $field_list['banlist_banexpires'] = $pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED] ? time() + 60 * 60 * $pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED] : 0;
                        }
                        break;
                    case 4:
                        // Original ban type - we always ignore this and force to 'imported'
                        break;
                    case 5:
                        // Ban reason originally generated by E107
                        $field_list['banlist_reason'] = $f;
                        break;
                    case 6:
                        // Any user notes added
                        $field_list['banlist_notes'] = $f;
                        break;
                    default:
                        // Just ignore any others
                }
            }
            $qry = "REPLACE INTO `#banlist` (" . implode(',', array_keys($field_list)) . ") values ('" . implode("', '", $field_list) . "')";
            //	  echo count($field_list)." elements, query: ".$qry."<br />";
            if (!$sql->db_Select_gen($qry)) {
                $mes->addError(BANLAN_50 . $line_num);
                return BANLAN_50 . $line_num;
            }
        }
    }
    // Success here - may need to delete old imported bans
    if ($override_imports) {
        $sql->db_Delete('banlist', "`banlist_bantype` = " . eIPHandler::BAN_TYPE_TEMPORARY);
    }
    @unlink($filename);
    // Delete file once done
    $mes->addSuccess(str_replace('--NUM--', $line_num, BANLAN_51) . $filename);
    return str_replace('--NUM--', $line_num, BANLAN_51) . $filename;
}
开发者ID:gitye,项目名称:e107,代码行数:84,代码来源:banlist.php

示例11: era_callback


//.........这里部分代码省略.........
            //  writeMessageLine($bgcolor, 'errdetail',
            //   "Primary insurance EOB was already posted for the following claim");
            // }
        }
        if ($csc == '4') {
            //Denial case, code is stored in the claims table for display in the billing manager screen with reason explained.
            $inverror = true;
            if (!$debug) {
                if ($pid && $encounter) {
                    $code_value = '';
                    foreach ($out['svc'] as $svc) {
                        foreach ($svc['adj'] as $adj) {
                            //Per code and modifier the reason will be showed in the billing manager.
                            $code_value .= $svc['code'] . '_' . $svc['mod'] . '_' . $adj['group_code'] . '_' . $adj['reason_code'] . ',';
                        }
                    }
                    $code_value = substr($code_value, 0, -1);
                    //We store the reason code to display it with description in the billing manager screen.
                    //process_file is used as for the denial case file name will not be there, and extra field(to store reason) can be avoided.
                    updateClaim(true, $pid, $encounter, $_REQUEST['InsId'], substr($inslabel, 3), 7, 0, $code_value);
                }
            }
            writeMessageLine($bgcolor, 'errdetail', "Not posting adjustments for denied claims, please follow up manually!");
        } else {
            if ($csc == '22') {
                $inverror = true;
                writeMessageLine($bgcolor, 'errdetail', "Payment reversals are not automated, please enter manually!");
            }
        }
        if ($out['warnings']) {
            writeMessageLine($bgcolor, 'infdetail', nl2br(rtrim($out['warnings'])));
        }
        // Simplify some claim attributes for cleaner code.
        $service_date = parse_date($out['dos']);
        $check_date = $paydate ? $paydate : parse_date($out['check_date']);
        $production_date = $paydate ? $paydate : parse_date($out['production_date']);
        if ($INTEGRATED_AR) {
            $insurance_id = arGetPayerID($pid, $service_date, substr($inslabel, 3));
            if (empty($ferow['lname'])) {
                $patient_name = $out['patient_fname'] . ' ' . $out['patient_lname'];
            } else {
                $patient_name = $ferow['fname'] . ' ' . $ferow['lname'];
            }
        } else {
            $insurance_id = 0;
            foreach ($codes as $cdata) {
                if ($cdata['ins']) {
                    $insurance_id = $cdata['ins'];
                    break;
                }
            }
            $patient_name = $arrow['name'] ? $arrow['name'] : $out['patient_fname'] . ' ' . $out['patient_lname'];
        }
        $error = $inverror;
        // This loops once for each service item in this claim.
        foreach ($out['svc'] as $svc) {
            // Treat a modifier in the remit data as part of the procedure key.
            // This key will then make its way into SQL-Ledger.
            $codekey = $svc['code'];
            if ($svc['mod']) {
                $codekey .= ':' . $svc['mod'];
            }
            $prev = $codes[$codekey];
            $codetype = '';
            //will hold code type, if exists
            // This reports detail lines already on file for this service item.
开发者ID:rreddy70,项目名称:openemr,代码行数:67,代码来源:sl_eob_process.php

示例12: parse_date

 function parse_date($date)
 {
     if (function_exists('parse_date')) {
         return parse_date($date);
     } else {
         $split_pattern = '[\\/\\-\\.]';
         if (preg_match("/(\\d{4}){$split_pattern}(\\d{1,2}){$split_pattern}(\\d{1,2})/", $date, $matches)) {
             return array('year' => $matches[1], 'month' => $matches[2], 'day' => $matches[3]);
         } else {
             return false;
         }
     }
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:13,代码来源:super_products_list_model.php

示例13: getdate

// set default vars
$dateArr = getdate();
// start: first of last year
// end: today
$start_time = mktime(0, 0, 0, 1, 1, $dateArr['year'] - 1);
$start_date = date('m/d/Y', $start_time);
$end_date = date('12/31/Y');
$account1_id = $_SESSION['default_summary1'];
$account2_id = $_SESSION['default_summary2'];
$net_multiplier = -1;
if (isset($_POST['calc'])) {
    $date_verify = parse_date($_POST['start_date']);
    if ($date_verify == -1) {
        $error = 'Bad start date';
    } else {
        $date_verify = parse_date($_POST['end_date']);
        if ($date_verify == -1) {
            $error = 'Bad end date';
        }
    }
    // refresh data
    if ($error == '') {
        // don't update dates unless valid
        $start_date = $_POST['start_date'];
        $end_date = $_POST['end_date'];
        $net_multiplier = (int) $_POST['net_multiplier'];
    }
    $account1_id = $_POST['account1_id'];
    $account2_id = $_POST['account2_id'];
}
// Add or subtract display vars
开发者ID:fedoracooper,项目名称:cooper-accounting-php,代码行数:31,代码来源:account_summary.php

示例14: find_day_of_month

/**
 * Find Nth (day) in (month) of (year)
 * Return timestamp for 2 AM of user's timezone - we use this for DST, and DST usually is effective at 2?
 */
function find_day_of_month($n, $day, $month, $year)
{
    global $time_zone_offset;
    $times_day_found = 0;
    $date_month = $month;
    $date = 1;
    while (($times_day_found < $n || $n == 'last') && $date_month == $month) {
        $time = parse_date("{$month} {$date}, {$year}");
        $date_month = date('M', $time + $time_zone_offset);
        $day_found = date('D', $time + $time_zone_offset);
        if ($day_found == $day) {
            $times_day_found++;
        }
        $date++;
    }
    return $time;
}
开发者ID:JoshuaGross,项目名称:cortex-frame,代码行数:21,代码来源:time.php

示例15: parse_date

                                    ?>
</a>.
			   </h5>
			   <p><?php 
                                    echo $row_bookmark['title'];
                                    ?>
</p>
			   <p><a href="<?php 
                                    echo $row_bookmark['url'];
                                    ?>
" target="_blank"><?php 
                                    echo $row_notes['url'];
                                    ?>
</a></p>
			   <p><i class="icon-time"></i>  <?php 
                                    echo parse_date($row_friends_activities_query['date']);
                                    ?>
 </p>
		 </div>
		 <?php 
                                    if ($_SESSION['logged'] == true) {
                                        vote_up($row_friends_activities_query['activity_tracker'], 'bookmark', $row_friends_activities_query['profile_ida']);
                                    }
                                    ?>
	</div>
 
 <?php 
                                }
                            }
                        }
                    }
开发者ID:neelkamal0666,项目名称:FosterGemNews,代码行数:31,代码来源:newsfeed.php


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