如果时间戳匹配今天的日期,SQLite选择行 [英] SQLite select rows if timestamp matches today's date
本文介绍了如果时间戳匹配今天的日期,SQLite选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果条目时间戳与今天的日期匹配,我想从SQLite表中选择所有条目.
I Would like to select all entries from an SQLite table if the entries timestamp matches todays date.
我正在查询SQLite数据库,如下所示:
I am querying an SQLite database as follows:
// Tasks table name
private static final String TABLE_TASKS = "tasks";
// Tasks Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_TIMESTAMP = "timestampGMT";
private static final String KEY_DESCRIPTION = "description";
String selectQuery = "SELECT * FROM " + TABLE_TASKS + " WHERE "+ KEY_TIMESTAMP+">=date('now', '-1 day')";
此行为是我最近的行为,但我不想选择最近24小时内的所有条目.我只想选择今天的日期是否与时间戳匹配.
This behavior is the closest I have come but I do not wish to select all entries within the last 24hrs. I only want to select if todays date matches the timestamp.
如何仅选择表中时间戳与今天的日期匹配的行.
How can I select only the rows in the table who's timestamp matches todays date.
日期格式为:数据库中的2014-07-05 12:59:35.
date format is: 2014-07-05 12:59:35 in the database.
推荐答案
这项工作吗?
date('now', 'start of day')
这篇关于如果时间戳匹配今天的日期,SQLite选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文