D
D
demortall2021-11-20 22:13:06
SQLite
demortall, 2021-11-20 22:13:06

How to select records for today's sqlite?

619947b033490374042831.png
I don't have datetime data type when I select I write it as a string to a table like this
strftime('%d.%m.%Y %H:%M')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-11-20
@demortall

If storing as a string, use a format that can be compared:
strftime("%Y-%m-%d %H:%M");

$start = strftime("%Y-%m-%d");
$end = strftime("%Y-%m-%d", strtotitme("tomorrow"));
$db->query("SELECT * FROM tab WHERE time > ='$start' AND time < '$end'");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question