Im trying to make a query where time() is between date_start and date_end
i tried:
date_start > CURRENT_TIMESTAMP AND date_end < CURRENT_TIMESTAMP
and
WHERE CURRENT_TIMESTAMP BETWEEN date_start AND date_end
Still it does not workout for me. Tried CURRENT_TIMESTAMP() too.
Mysql
id item_id percentage rabatcode date_start date_end
9 6 50 XXY-GGS-82 1323817200 1324422000
Compare
NOW()against the values viaFROM_UNIXTIME():Ideally, if it is possible for you to modify your database structure, it is usually much better to store dates as MySQL’s native
DATETIMEtype, owing to the fact that MySQL’s date processing functions work with the date types without conversion.