MYSQL query between two timestamps
You just need to convert your dates to UNIX_TIMESTAMP
. You can write your query like this:
SELECT *
FROM eventList
WHERE
date BETWEEN
UNIX_TIMESTAMP('2013/03/26')
AND
UNIX_TIMESTAMP('2013/03/27 23:59:59');
When you don't specify the time, MySQL will assume 00:00:00
as the time for the given date.
Try:
SELECT *
FROM eventList
WHERE `date` BETWEEN FROM_UNIXTIME(1364256001) AND FROM_UNIXTIME(1364342399)
Or
SELECT *
FROM eventList WHERE `date`
BETWEEN '2013-03-26 00:00:01' AND '2013-03-26 23:59:59'
Try this one. It works for me.
SELECT * FROM eventList
WHERE DATE(date)
BETWEEN
'2013-03-26'
AND
'2013-03-27'