时间:2021-07-01 10:21:17 帮助过:107人阅读
大神门来帮帮忙呀
假设你数据库存储时间的字段叫 time 格式是int 存储的是时间戳
可以这样查询
$t1 = 2014-03-16 09:15:20;$t2 = 2014-04-16 09:15:20;$timestart = strtotime($t1);$timeend = strtotime($t2);$model = M("你的数据表")$res = $model -> where("time >= $timestart and time <= $timeend ")->select();
假设你数据库存储时间的字段叫 time 格式是int 存储的是时间戳
可以这样查询
$t1 = 2014-03-16 09:15:20;$t2 = 2014-04-16 09:15:20;$timestart = strtotime($t1);$timeend = strtotime($t2);$model = M("你的数据表")$res = $model -> where("time >= $timestart and time <= $timeend ")->select();
datetime也支持大于小于,至少mysql和sql server都可以