I have the following query which I'm assuming should return results :
SELECT
*
FROM
media
WHERE
sent < package
AND
flag = 0
AND
UNIX_TIMESTAMP(last_run) + 1800 < UNIX_TIMESTAMP(NOW())
ORDER BY
last_run ASC
LIMIT 1
I have the following row inside my DB
`last_run` = '2014-09-13 17:30:0'
`flag` = '0'
`sent` = '4'
`package` = '400'
As now it's currently 2014-09-15 02:53:57 as per the server with a time() of 1410749659 I assume this should be returned? if not, what's the reason behind this?
When checking the timestamps against mySQL I'm getting the following result from this query
SELECT UNIX_TIMESTAMP(last_run), UNIX_TIMESTAMP(NOW()), last_run FROM media LIMIT 1
----------------------------------------------------------------------------
UNIX_TIMESTAMP(last_run) UNIX_TIMESTAMP(NOW()) last_run
1410752462 1410750296 2014-09-14 20:41:02
last_run < NOW() - INTERVAL 1800 SECOND. But that aside, what is the datatype of thelast_runcolumn?last_runhas a datatype ofDATETIMElast_runhave a timestamp greater thannow()? Is this a timezone issue?last_runis2014-09-14 22:41:02.NOW()is2014-09-14 22:04:56