当前位置: 代码迷 >> 其他数据库 >> 小弟我被sqlite的取时间搞疯了,
  详细解决方案

小弟我被sqlite的取时间搞疯了,

热度:6285   发布时间:2013-02-26 00:00:00.0
我被sqlite的取时间搞疯了,求助。。。。。。。。。。。。。
例如,数据有一条数据,其时间字段为'2009-1-1 11:11:11'

现在我要选出小于当前时间3个月前的数据

问题一:
SQL code
select * from table where create_time < datetime(CURRENT_TIMESTAMP,'localtime','-3 MONTH')

以上无任何结果。

而我单独执行
select datetime(CURRENT_TIMESTAMP,'localtime','-3 MONTH') as test 
这里明明显示的是 '2009-7-13 8:53:22'

问题二:
SQL code
select * from table where create_time > datetime(CURRENT_TIMESTAMP,'localtime','-1 year')

就有数据了


------解决方案--------------------------------------------------------
你的时间格式是什么?在控制面板中看看
------解决方案--------------------------------------------------------
select datetime('now','localtime');
结果是怎样
  相关解决方案