I have the following entry in my DB table
eventName(varchar 100) -> myEvent
date(timestamp) -> 2013-03-26 09:00:00
and I am trying to use the following query;
SELECT *
FROM eventList
WHERE `date` BETWEEN UNIX_TIMESTAMP(1364256001) AND UNIX_TIMESTAMP(1364342399)
i.e between 2013-03-26 00:00:01 and 2013-03-26 23:59:59
but it is giving me 0 results.
I have tried expanding the date range with no luck and there are definitely results within the range.
any help is appreciated.
You just need to convert your dates to
UNIX_TIMESTAMP
. You can write your query like this:When you don't specify the time, MySQL will assume
00:00:00
as the time for the given date.@Amaynut Thanks
above mention, code works and my problem solved.
Try:
Or
Try this one. It works for me.
Try below code. Worked in my case. Hope this helps!
Try the following: