Getting MySQL data after specific date
How can I fetch MySQL data after a specific timestamp? What should the query look like?
mysql_query("SELECT * FROM table where TheNameOfTimestampColumn > than the date");
Solution 1:
SELECT * FROM table WHERE TheNameOfTimestampColumn > '2009-01-28 21:00:00'
SELECT * FROM table WHERE TheNameOfTimestampColumn > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY)
Solution 2:
You can select this by :
select * from table_name where date_column > "2001-01-01 00:00:00"
or if you need data within certain time frame then you can try using between
key word such as:
select * from table_name where date_column
between "2018-01-04 00:00:00" and "2018-01-04 11:59:59";
Note that date format should be in YYYY-MM-DD HH:MM:SS
Solution 3:
If you're using a unix timestamp, you can do the following:
SELECT * FROM table WHERE TheNameOfTimestampColumn > FROM_UNIXTIME(your_time_stamp_here)