我從數據庫中獲取數據的查詢,日期格式查詢在Laravel
select mailboxtoolno,DATE_FORMAT(maileventdate,'%d %b %Y') as
date,DATE_FORMAT(maileventdate,'%H:%i:%s') as time,mailtype from
domiciliation_mailbox where reg_id =".$regid." order by id DESC
我怎樣才能改變它laravel雄辯模型,
我一直在試圖改變它像,
$timeline= mailbox::select('mailboxtoolno','DATE_FORMAT(maileventdate,"%d %b %Y") as date','DATE_FORMAT(maileventdate,"%H:%i:%s") as time','mailtype')
->where('reg_id', '=',$reg_id)
->paginate(10);
,但得到這樣的錯誤,
Unknown column 'DATE_FORMAT(maileventdate,"%d %b %Y")' in 'field list'
如何在laravel中獲得日期格式的正確值
您使用的日期格式中選擇查詢,因此錯誤 –