I am trying to query a MySQL database for all records for tomorrow (not the next 24 hours). All the dates are stored as a unixtimestamp.
Could I use the CURDATE() function in anyway?
Your help would be much appreciated!
I am trying to query a MySQL database for all records for tomorrow (not the next 24 hours). All the dates are stored as a unixtimestamp.
Could I use the CURDATE() function in anyway?
Your help would be much appreciated!
Select those records whose epoch timestamp is
BETWEEN UNIX_TIMESTAMP(CURDATE() + INTERVAL 1 DAY)
AND
UNIX_TIMESTAMP(CURDATE() + INTERVAL 2 DAY - INTERVAL 1 SECOND)
The beginning of tomorrow is one day beyond today, taken with precision to the second.
The end of tomorrow is one second less than two days beyond today, again taken with second precision.
While it is tempting simply to add 86,399 seconds to the beginning of tomorrow to find its end, some days have more seconds and some have fewer. Better to let date arithmetic functions compute the end.