Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个 android 应用程序,我需要向用户提供奖品,它应该在 24 小时内到期,并且应该在我的应用程序中显示减少时间。我需要将奖品提供时间存储在 sq Lite 和那个时间应该减少到24小时到0小时任何人都可以帮我解决这个问题吗?
使用本教程.. 将日期保存为 VARCHAR 并在检索后将其转换为日期对象。
迪斯
我认为将数据转换为Integer(SQLite 数据类型)是在 SQLite 中存储日期的最佳方式,因为它使比较(使用 SQL 查询)比将日期存储为文本时更容易。如果您使用java.util.Date使用方法getTime()以毫秒为单位获取时间并将该值存储在数据库中。
Integer
java.util.Date
getTime()