使用模型后查询出来的数据时间不对

浏览:595 发布日期:2020/11/09 分类:求助交流 关键字: tp5 模型 model date 时间格式
我使用模型查询数据EmailLog::where(["create_time"=>["BETWEEN",[$data["s_time"],$data["e_time"]]]])
->field(["DATE_FORMAT(create_time,'%d') as create_time","COUNT(*) AS count"])
->group("DATE_FORMAT(create_time, '%Y-%m-%d')")
->select();
查询出来的结果
[{"create_time":"1970-01-01 08:00:03","count":1},{"create_time":"1970-01-01 08:00:04","count":24}]
其实时间格式是
[{"create_time":"2020-02-03","count":1},{"create_time":"2020-02-04","count":24}]
这样的,用模型时间格式就被重置为初始化时间了,这个需要在模型里面怎么配置呢
最佳答案
评论( 相关
后面还有条评论,点击查看>>