Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select data from within the last 28 days

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
I'm trying to select data from within the last 28 days using PHP.

I don't think I'm getting the right results. This is either due to incorrect select or because of the leap year?

$date28 = date("Y-m-d", strtotime("-28 day"));

Is that correct or is there another way to do it?


 
you could try this,

SELECT *
FROM yourtable
WHERE yourdatefield > DATE_SUB( Now(), INTERVAL 28 DAY);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top