MySQL时间戳选择日期范围 [英] MySQL timestamp select date range
本文介绍了MySQL时间戳选择日期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不确定该从哪里开始.任何人都可以帮助/指出正确的方向.
Not sure really where to start with this one. Can anyone help/point me in the right direction.
我在MySQL中有一个timestamp列,我想选择一个日期范围,例如所有的时间戳都在2010年10月.
I have a timestamp column in MySQL and I want to select a date range for example, all timestamps which are in Oct 2010.
谢谢.
推荐答案
通常是这样:
SELECT *
FROM yourtable
WHERE yourtimetimefield>='2010-10-01'
AND yourtimetimefield< '2010-11-01'
但是因为您有一个unix时间戳,所以需要这样的东西:
But because you have a unix timestamps, you'll need something like this:
SELECT *
FROM yourtable
WHERE yourtimetimefield>=unix_timestamp('2010-10-01')
AND yourtimetimefield< unix_timestamp('2010-11-01')
这篇关于MySQL时间戳选择日期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文