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");
You can use DATE() from MySQL to select records with a particular date. The syntax is as follows. SELECT *from yourTableName WHERE DATE(yourDateColumnName)='anyDate'; To understand the above syntax, let us first create a table.
You just need to tell the processor what format the date/time is in: Select * from Table where date Between to_date('2009-05-24 06:15:00', 'yyyy-mm-dd hh24:mi:ss') and to_date('2009-05-24 08:15:00 ', 'yyyy-mm-dd hh24:mi:ss').
In order to get the date from the timestamp, you can use DATE() function from MySQL.
SELECT * FROM table WHERE TheNameOfTimestampColumn > '2009-01-28 21:00:00' SELECT * FROM table WHERE TheNameOfTimestampColumn > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With