需要开始时间跟结束时间的范围查询数据
假如:前端传入的是2023-06-27,开始跟结束都是2023-06-27,目前这样返回的是空数组。
但是数据库创建的数据是6月27号上午10点的 有11点的。还是下午2点的。
数据库表的createtime存的是时间戳。
现在是要查询27号当天0点到23:59点的才对吧?实现这样要怎么写?
$startTime = "2023-06-27";
$endTime = "2023-06-27";
$list = Db::name('cashbook')->where("createtime","between",[strtotime($startTime),strtotime($endTime)])->select();
有专门的时间查询方法
更多细节参考文档:https://www.kancloud.cn/manual/thinkphp5_1/354029