Home >Backend Development >PHP Tutorial >请问mysql数据库里面有个字段时间戳,怎么查询间隔日期之间的数据呢

请问mysql数据库里面有个字段时间戳,怎么查询间隔日期之间的数据呢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:14:00990browse

mysql 有个字段Reg_addtime是时间戳方式存的时间值。

请问怎么查询,比如,2013年5月1日,到2013年5月10日,注册的会员列表呢。

本人小菜,一瓶子不满,半瓶子逛荡。大侠指点一下吧。


回复讨论(解决方案)

SELECT * FROM tbl_name WHERE FROM_UNIXTIME(Reg_addtime, '%Y-%m-%d') BETWEEN '2013-05-01' AND '2013-05-10'

也可以这样:

select * from order where timestamp between  UNIX_TIMESTAMP('2013-05-01 00:00:00') and UNIX_TIMESTAMP('2013-05-10 00:00:00');
  

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:get参数型字符串取值