I am creating a web app where if a user clicks on Link called \"WEEK\", the page shows up all the posts which were submitted in that week. There\'s also an option to view all th
Well, by slightly modifying your code, you could realize the WEEK- and MONTH-Problem using SQL!
Regarding to: MySQL-Documentation, this might be the solution for you:
SELECT *
FROM posts
WHERE YEARWEEK(post_date) = YEARWEEK(NOW())
Second one may be a bit more complicated:
SELECT *
FROM posts
WHERE YEAR(post_date) = YEAR(NOW())
AND MONTH(post_date) = MONTH(NOW())
I hope, i could help you.