我有两张桌子订单和股票。订单表中包含名为' Order_Date'的列,而共享表包含名为' HoldingPeriod'的列。那么如何从365天确定客户订单的剩余天数(Order_Date)。 请帮助我不知道如何在此处启动代码,但这是来自共享表的查询;
<?php
$SeeShare=ViewShares();
while($row=mysql_fetch_array($SeeShare))
{
$share = $row['ShareName'];
$numshares = $row['NumberShares'];
$askprice = $row['AskPrice'];
$bidprice = $row['BidPrice'];
$commfee = $row['CommFee'];
$ShareInterest=$row['CommPercent'];
$Maturity=$row['HoldingPeriod'];
}?>
以下是查询付费订单的代码
<?php
$status='';
$Paid=QueryPaidFor($status);
while($row=mysql_fetch_array($Paid))
{
$share=$row['ShareName'];
$sharenum=$row['NumberShares'];
$amount=$row['Order_Price'];
$status=$row['status'];
$orderdate=$row['OrderDate'];
}
?>
答案 0 :(得分:0)
使用以下代码段
$currentDate = date("Y-m-d");
$totalDays = $Maturity;
$usedDays = round(abs(strtotime($currentDate)-strtotime($orderdate))/86400);
$remainingDays = $totalDays-$usedDays;
希望这可以帮助您解决问题。