如何中检索从SQLite数据库DATETIME格式 [英] How to retreive DATETIME format from Sqlite database

查看:118
本文介绍了如何中检索从SQLite数据库DATETIME格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已保存的日期(java.util.date对象)在SQLite表的日期时间字段。现在,如何检索这个日期这将是相同的格式java.util.date的。其实我想比较的时间差(以毫秒为单位)当前日期和存储日期间。

I have stored date (java.util.date object) in a DATETIME field of a Sqlite table. Now, how to retrieve this date which would be of the same format as java.util.date. Actually I want to compare the time difference (in milliseconds) between current date and the store date.

任何帮助是非常AP preciated。

Any Help is highly appreciated.

推荐答案

检索为Cursor.getString()和传递价值的SimpleDateFormat使Date对象。有没有直接的方法获取日期的对象。

Retrieve as Cursor.getString() and pass that value to SimpleDateFormat to make the date object. There is no straight method for getting the date object.

这篇关于如何中检索从SQLite数据库DATETIME格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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