Getting MySQL data after specific date

0 votes
asked Dec 6, 2009 by testkhan

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");

3 Answers

0 votes
answered Dec 6, 2009 by angel-king-47
SELECT * FROM table WHERE TheNameOfTimestampColumn > '2009-01-28 21:00:00'
SELECT * FROM table WHERE TheNameOfTimestampColumn > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY)

And yes you should work on your acceptance rate

0 votes
answered Dec 11, 2016 by iautomation

If you're using a unix timestamp, you can do the following:

SELECT * FROM table WHERE TheNameOfTimestampColumn > FROM_UNIXTIME(your_time_stamp_here)
0 votes
answered Sep 15, 2017 by koushik-das

You can use MySQL DATE function like below

For instance, if you want results after 2017-09-05

SELECT DATE(timestamp_field) as date FROM stocks_annc WHERE DATE(timestamp_field) >= '2017-09-05'

Make sure to wrap the date within single quotation ''

Hope this helps.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...