K
K
Kuusandr2020-05-03 21:08:27
Android
Kuusandr, 2020-05-03 21:08:27

How to make a selection from a table to a Date type field for a specific day, for sqlite droid?

Table with the following structure:

CREATE TABLE smlog (
    id       INTEGER PRIMARY KEY,
    data     DATE,
    num INT
);

I need to select all records for the whole day. The following select worked perfectly on PC
SELECT  *  FROM smLog  where strftime("%m/%d/%Y","data")="05/02/2020"

On the droid, this same select gave a dummy during processing.
Help. What is the jamb? Or maybe abandon the date field altogether and use separate int fields for the day, month, year, and time of day?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kuusandr, 2020-05-06
@Kuusandr

The datetime class in Java was designed by the devil to torment the souls of developers.

I
illuzor, 2020-05-03
@iLLuzor

There is no DATE type in sqlite. You can store the date timestamp as an INTEGER.
https://www.sqlite.org/datatype3.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question