关于是时间戳对比的问题
在数据库中,我以时间戳存储数据(time())
现在我要使用如2012/8/22这样的日期去查询
但是遇到一个关于称数的问题
我该如何做才能查到找数据库中等于今天的这个所有数据呢?
------解决方案--------------------
select * from tt where from_unixtime( time, '%y/%m/%d' ) ='2012/8/22'
------解决方案--------------------
我建议你将2012/8/22 转换成时间戳 比如 n
搜索时间 between n and (n+86400-1)
------解决方案--------------------
$dated = strtotime($_get['dateitme']);
qsj_magazine.datetime =$dated;
------解决方案--------------------
$dated = strtotime($_get['dateitme']);
qsj_magazine.datetime =$dated;
------解决方案--------------------
$dated = strtotime($_get['dateitme']);
qsj_magazine.datetime =$dated;
------解决方案--------------------
php code$oldtime = '2012-8-22 23:59:59'; $catime = strtotime($oldtime);select * from qsj_user_profile,qsj_magazine where qsj_magazine.uid = qsj_user_profile.uid and qsj_magazine.datetime > '$catime ';
------解决方案--------------------
我都是将2012/8/22转换成时间戳,需要转换两个值,第一个是2012/8/22这天0点0分,第二个是
2012/8/23这天0点0分
然后再搜索time字段介于上面两个值之间
------解决方案--------------------
php code$oldtime = '2012-8-22 23:59:59'; $catime = strtotime($oldtime);select * from qsj_user_profile,qsj_magazine where qsj_magazine.uid = qsj_user_profile.uid and qsj_magazine.datetime > '$catime ';