Sqlite查询,将da​​tetime字段与当前日期时间进行比较 [英] Sqlite query, compare datetime field with current date time

查看:555
本文介绍了Sqlite查询,将da​​tetime字段与当前日期时间进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序中,我想查询过去的记录。有一个datetime字段命名为task_dateTime。如果使用,
从任务中选择task_dateTime;
结果将如下所示,
2012年4月26日16:32
2012年4月27日16:38
2012年4月29日05:32



我如何查询过去的记录。这意味着我想与当前时间的task_dateTime字段进行比较。

解决方案

尝试从task_dataTime< CURRENT_TIME ;


In my iPhone app i wanted to query past records. There is a datetime field which named as "task_dateTime" . If used, select task_dateTime from tasks; Results will look like This, Apr 26, 2012 16:32 Apr 27, 2012 16:38 Apr 29, 2012 05:32

How can i query past records. It means i wanted to compare with "task_dateTime" field with current time.

解决方案

Try select task_dateTime from tasks where task_dataTime < CURRENT_TIME;

这篇关于Sqlite查询,将da​​tetime字段与当前日期时间进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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