日期:2014-05-16 浏览次数:20749 次
select * from actives where starttime between UNIX_TIMESTAMP() and UNIX_TIMESTAMP() + 3*24*60*60;
------解决方案--------------------
mysql> select date_add(now(),interval -1 day);
+---------------------------------+
| date_add(now(),interval -1 day) |
+---------------------------------+
| 2012-07-23 13:20:24 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> select date_add(now(),interval -1 week);
+----------------------------------+
| date_add(now(),interval -1 week) |
+----------------------------------+
| 2012-07-17 13:20:29 |
+----------------------------------+
1 row in set (0.00 sec)
mysql> select date_add(now(),interval -1 month);
+-----------------------------------+
| date_add(now(),interval -1 month) |
+-----------------------------------+
| 2012-06-24 13:20:32 |
+-----------------------------------+
1 row in set (0.00 sec)