SQLite query that calculates whether the time of the Unix era is today

I have an integer column that contains the time value of the Unix era. I want to calculate if he hits today.

For example, let today be the 24th day of the month. The query should return rows that fall on the 24th, but not those that fall on the 23rd or some time before.

Thanks for watching.

+3
source share
3 answers

You can use Julian day for this, as it can be rounded to the border of the day. See http://www.sqlite.org/lang_datefunc.html

+3
source

Use DATE(TheColumn, 'unixepoch')to get the date.

+1
source

With MySQL Try:

SELECT *
FROM yourTable
WHERE DATE(FROM_UNIXTIME(yourUnixEpochField)) = DATE(NOW());
-2
source

Source: https://habr.com/ru/post/1794478/


All Articles