select query in mysql to select the data before 15 minutes in php -


i have table:

enter image description here

i want select data res_time within past 15 minutes. using:

select * test res_time >= date_sub(now(), interval 15 minute).  select * `test` res_time between timestamp(date_sub(now(), interval 15 minute)) , timestamp(now()). 

if using php can this

$beforetime = date("y-m-d h:i:s",strtotime("-15 minutes")); $query = "select * test res_time >= '$beforetime' " ; 

if want pure sql solution follow other mentioned solutions.

cheers !!!


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -