Hello,
I have some problems with comparing two timestamps in mysql.
I want so compare the current time with the timestamps of my posts, and take all the posts that have been created the last day (24 hours).
Here is what I tried so far:
WHERE UNIX_TIMESTAMP(CURDATE()) - UNIX_TIMESTAMP(m.poster_time) <= 60*60*24
but I don“t get it working.
Can someone help, please ?
I would do something like
UNIX_TIMESTAMP(m.poster_time) >= (UNIX_TIMESTAMP(CURDATE()) - 60*60*24)
Thank you that helped.
I did myself another mistake,
you need to use NOW() and not CURDATE()
Here is the working code:
WHERE m.poster_time >= (UNIX_TIMESTAMP(NOW()) - 60*60*24)