【发布时间】:2014-03-26 22:31:33
【问题描述】:
我将信息存储在一个 sqlite 数据库表中,如下所示:
ActionDate 列的类型为:DEFAULT CURRENT_TIMESTAMP
private String getDateTime() {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault());
Date date = new Date();
return dateFormat.format(date);
}
我想编写一个 SQL 查询,它从 sqlite DB 返回表中具有 ActionDate 值作为今天日期的所有行。但是,由于 ActionDate 是时间戳类型,因此将其转换为今天的日期最合适的方式是什么。
【问题讨论】:
标签: java android sqlite timestamp