This is my first question so bear with me and just let me know if it's not clear what I mean. I have no idea how to look for an answer. I'm pretty new to both Android and Java.
I want to use sqLite database table for storing values and I want to have only one, unique date and "value" combination per day. Idea is to make kind of a log where anything can be logged only once per day (except updating or editing afterwards). I decided to use Unix timestamps and INTEGER as data type for date. Table looks something like this:
("Unix_timestamp","value","state")
Right now I am inserting System.currentTimeMillis()/1000L
but then there might be thousands of dates per one day with the same "value" not to mention problem with selecting.
What is the most convenient way of inserting and selecting dates? Should it be done via sqLite functions or some Android or java methods?
EDIT: I almost forgot to add: I have an idea of inserting dates in Unix time but in a way they are eg. always the begining of the day (midnight) but I couldn't figure out how to do this, which methods to use. I feel like sqLite is really bad when it comes to dates.
Aucun commentaire:
Enregistrer un commentaire