开发者

SQL Timestamp Where clause 30 mins ago

开发者 https://www.devze.com 2023-01-25 00:17 出处:网络
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(CUR

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号