Home  >  Article  >  Backend Development  >  小弟我要从数据库查询今天的订单如何查

小弟我要从数据库查询今天的订单如何查

WBOY
WBOYOriginal
2016-06-13 12:58:24934browse

我要从数据库查询今天的订单怎么查?
数据库时间是以时间戳形式保存的。

我传进来的参数是形如2012-11-22的,是不是要先把时间转换为时间戳,然后从数据库查时间戳大于这个值的数据,可是得到的结果是2012年12月1日以后的。。。

应该怎么弄?
------解决方案--------------------
select * from tt Where DATE_FORMAT(FROM_UNIXTIME(time), '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d') 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn