Jump to content

Archived

This topic is now archived and is closed to further replies.

jentino28

mysql date search

Recommended Posts

Hi guys,
I looked around and googled but can't find a straight answer.

I designed a website where i have my links as :

            Today | Yesterday | Past 5 days | Past 7 days | Past month

i can do "today" and "yesterday" mixing php's time functions and mysql but im struggling with "7 days".

i attempted using DATE_SUB(CURDATE(),INTERVAL 7 DAY); but it only pulls queries found on the last 7th day, not between now and seven days.which is what im looking for.

Please help me.


thanks. ;)

Share this post


Link to post
Share on other sites
You want "WHERE yourDateColumn - INTERVAL 7 DAY <= NOW()".

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.