xorinzor xorinzor - 11 days ago 7
MySQL Question

MySQL Select 7 Complete Days ago

How can I get the records from 7 complete days ago?

using

Interval 7 days
at a time of 1pm for example would select up until 7 days ago at 1pm, whereas I need it to be 7 days ago from the start of that day (00:00).

Is there a way within the SQL query to achieve this? or would it require some custom PHP code?

Seb Seb
Answer

Use

SELECT DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)