MYSQL query / dates older than 1 week ago (all datetimes in UTC)
SELECT * FROM table WHERE DATEDIFF(NOW(),colname) > 7;
SELECT * FROM tbl WHERE datetime < NOW() - INTERVAL 1 WEEK
If your table stores datetimes in different timezone than what NOW()
returns, you can use UTC_TIMESTAMP()
instead to get the timestamp in UTC.