='".$kstime."' and createdtim"/>
PHP头条
热点:

php日期搜索为什么不包括当天,该怎么处理


php 日期搜索为什么不包括当天
sql语句是这样的:
$kstime=$_POST["kstime"];
$jstime=$_POST["jstime"];

Select * From tab where createdtime >='".$kstime."' and createdtime <='".$jstime."'

搜索出来的结果为什么不包括当天的呢?当createdtime >='2012-6-7' and createdtime <='2012-6-10'的时候,7号和10号的内容显示不出来,请各位帮忙!


------解决方案--------------------
探讨

createdtime >='2012-6-7 00:00:00' and createdtime <='2012-6-10 23:59:59'

如果直接判断2012-6-7这样的话得用in

------解决方案--------------------
探讨
SQL code


#结果包含边界值
$sql = "SELECT * FROM tab WHERE createdtime BETWEEN '".$kstime."' AND '".$jstime."';"

------解决方案--------------------
Select * From tab where date_format(createdtime,'%Y-%m-%d') BETWEEN '2012-06-28' and '2012-06-30'

www.phpzy.comtrue/phprm/52145.htmlTechArticlephp日期搜索为什么不包括当天,该怎么处理 php 日期搜索为什么不包括当天 sql语句是这样的: $kstime=$_POST["kstime"]; $jstime=$_POST["jstime"]; Select * From tab where createdtime >='".$kstime."' and createdtim...

相关文章

PHP之友评论

今天推荐