Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以基本上我正在尝试制作一个功能来在我的网站上显示热门文章。
我正在徘徊如何在 mysql 中找到他们一周前或不到一周前制作的行?当日期字段数据来自诸如“1283124091”之类的 unix 时间戳时
where lastActivity > UNIX_TIMESTAMP(NOW() - INTERVAL 7 day)
请注意,这是 7 天的秒数。
如果您想要最近 7 个日历日的活动
where lastActivity > UNIX_TIMESTAMP(CURDATE() - INTERVAL 7 day)