Home >Backend Development >PHP Tutorial >急PHP,数据库中createtime字段类型为datetime,怎的根据这个查询一段时间内的数据

急PHP,数据库中createtime字段类型为datetime,怎的根据这个查询一段时间内的数据

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:52:071530browse

急急急,PHP,数据库中createtime字段类型为datetime,怎样根据这个查询一段时间内的数据
数据库中createtime字段类型为datetime,是年月日时分秒,怎样把他转换成时间戳?数据很多,一条好转换,可是那么多怎么办?
------解决方案--------------------

select unix_timestamp('2011-4-19 12:00:00');

------解决方案--------------------
查询可以直接比较
例如:select * from table where createtime>='2014-01-01 00:00:00' and creattime;

如果要批量显示可以这样
select *, unix_timestamp(createtime) as createtime from table;
------解决方案--------------------
select * from table where createtime>='2014-01-01 00:00:00' and creattime

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
Previous article:php生成随机密码的三种步骤Next article:It works!