sqlite日期比较 [英] sqlite date comparison

查看:290
本文介绍了sqlite日期比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类型为日期时间的列,值将以格式10-29-2011 08:25存储。

I have column of type date time and values are getting stored in format 10-29-2011 08:25.

我想仅查找行这比目前的日期时间少。对于当前日期和此日期时间列字段的日期比较的条件是什么?

I would like to find out the rows only which are less then current date-time. What will be the condition for date comparison for current date and this date-time column field?

谢谢。

推荐答案

可以使用datetime函数

you could use the datetime function

SELECT * FROM mytable
WHERE mydate > datetime('now') 

你甚至可以进行日期操作

you can even make date operations

SELECT * FROM mytable
WHERE mydate > datetime('now','-15 days') 

这篇关于sqlite日期比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆