假设我有一张票$create_time =“-08-02 12:35:04”.我想从当前日期和时间中减去$create_time,如$current_time =“-08-02 16:16:02”,以3小时41分钟的格式查找年龄.
$sql = "SELECT count(*) as total, create_time FROM article where ticket_id='$ticket_id'";
$otrs_db = $this->load->database('otrs',true);
$result = $otrs_db->query($sql);
foreach($result->result() as $row)
{?>
<?php echo $row->total ;?> Article(s)
Age: <?php echo date("Y-m-d H:i", strtotime("-$row->create_time",strtotime($thestime))) ?>Created: <?php echo $row->create_time; ?>
}
?>
我知道我的日期减法代码是错误的.我该怎么办?