我最终试图获得两个日期(ContractDate 和 CloseDate)之间的天数差异。它们的日期已经以 0000-00-00 格式存储在 MySQL 数据库中,但我无法将它们正确插入到公式中。我正在为此和其他一些项目使用以下查询。
$q_groups = mysql_query("SELECT CONCAT(contacts.last_name, ', ', contacts.first_name) as Name,
loans.subject_property as SubjectProperty, loans.fKeyUserLoanOfficer,
loan_types.name as LoanType, loans.closed_on as CloseDate, loans.contract_date as ContractDate, loans.amount as Amount, loan_status_types.name as LoanStatus,
loans._id, loans.fKeyReferral
FROM `loans`
LEFT JOIN `loan_status_types` ON (loans.fKeyLoanDetail = loan_status_types._id)
LEFT JOIN `loan_status` ON (loan_status._id = loan_status_types.fKeyType)
LEFT JOIN `loan_types` ON (loans.fKeyLoanType = loan_types._id)
LEFT JOIN `contacts` ON (contacts._id = loans.fKeyContact)
WHERE loans.fKeyGroup = '{$gid}' AND loan_status.name LIKE '%Closed%'
ORDER BY loans.closed_on DESC")
or die(ErrorLog::handle(mysql_error()));
我想要做的是让上面查询中的两个日期(ContractDate 和 CloseDate)填充下面的日期(红色):
$start = strtotime("2012-08-16");
$end = strtotime("2012-06-28");
$dayz = ($start - $end) / (60 * 60 * 24);
当我查看数据库时,“close_on”字段的日期为 2012-08-16,当我查看“contract_date”字段时,日期为 2012-06-28 ...但我无法获取此信息正确插入,没有错误或根本没有数据显示。
** 我遇到的问题是......如何用字段数据替换静态日期?**
谢谢,埃德