Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting MySQL data after specific date

Tags:

mysql

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"); 
like image 958
testkhan Avatar asked Dec 06 '09 11:12

testkhan


People also ask

How can I get specific date records in MySQL?

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.

How do I select data from a specific date?

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').

How do I get just the date from a timestamp?

In order to get the date from the timestamp, you can use DATE() function from MySQL.


1 Answers

SELECT * FROM table WHERE TheNameOfTimestampColumn > '2009-01-28 21:00:00' SELECT * FROM table WHERE TheNameOfTimestampColumn > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY) 
like image 76
Angel.King.47 Avatar answered Sep 22 '22 06:09

Angel.King.47