Moe
Moe

Reputation: 1557

android sqlite timestamp column

I have 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?

Upvotes: 1

Views: 4607

Answers (1)

Hrk
Hrk

Reputation: 2764

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.

Upvotes: 2

Related Questions