Reputation: 8125
I have a clause in mysql query to select with a timestamp of 3 days ago, to the nearest day:
WHERE TO_DAYS(wit_matches.created) = TO_DAYS(NOW() - INTERVAL 3 DAY))
I want to change this so that it selects rows with a timetamp of 3 days about, but to the nearest hour - i.e. 72 hours to the nearest hour (this is a cron job that will run ones per hour).
What's the best way of achieving this?
Upvotes: 0
Views: 120
Reputation: 719
You can try this.
WHERE wit_matches.created BETWEEN (NOW() - INTERVAL 73 HOUR) AND (NOW() - INTERVAL 72 HOUR)
Upvotes: 1