开发者

android sqlite timestamp column

开发者 https://www.devze.com 2023-02-17 11:38 出处:网络
I have开发者_如何学Go an Android SQLite table that has 5 columns in it. One of them is a timestamp.

I have开发者_如何学Go an Android SQLite table that has 5 columns in it. One of them is a timestamp. How can I check the timestamp (yyyy-mm-dd hh:mm:ss) for all of them and compare it to the local time on the Android then decide which row to read?


You can have a look at the sql date functions : http://www.sqlite.org/lang_datefunc.html

And you can obtain your local datetime with "new Date()" in Java.

In my application, I usually store unix timestamp and I can do operations I need quite easily with "new Date().getTimeinMillis()". It's simpler and more performant.

0

精彩评论

暂无评论...
验证码 换一张
取 消