SQL Timestamp Where clause 30 mins ago
How can I see if a time stamp was from >= 30 mins ago? Sorry if I am not des开发者_如何学Pythoncriptive enough but idk what else to say.
SELECT * FROM table_name where timestamp_field < DATE_ADD(CURRENT_TIMESTAMP(), INTERVAL -30 MINUTE);
NOW()-1800<=$THE_TIME_STAMP
the above obviously is wrong, should be
unix_timestamp()-1800<=$THE_TIME_STAMP
select
*
from
tbl
where
timestampdiff(minute, tbl.`date_time_field`, now()) >= 30
timestampdiff() @ mysql.com
convert(datetime, @ts) >= dateadd(minute, -30, getDate())
Replace @ts with your actual timestamp value.
精彩评论