xorinzor xorinzor - 6 days ago 5
MySQL Question

Select query for 7 Complete Days ago records using MySQL

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

using

Interval 7 days
at a time of 1 PM.

For example Select 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 any way within the SQL query to achieve these records or would it require some custom PHP code ?

Seb Seb
Answer

Use

SELECT DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
Comments