Welcome to the Treehouse Community
Looking to learn something new?
Karan JindalCourses Plus Student 1,406 Points
How to filter content on a page date wise?
Hi, I want to know: How to filter content on the basis date , month and year where the data is being fetched from the database.
Logan R22,989 Points
I would suggest storing the date as a time() [http://php.net/manual/en/function.time.php] and sorting the SQL by time.
SQL is rusty, but something like:
Select date from table ORDER BY date ASC
Edit: A link that provides an extended answer: http://www.w3schools.com/sql/sql_orderby.asp
You can convert time() into a date using the date() [http://php.net/manual/en/function.date.php] function.
string date ( string $format [, int $timestamp = time() ] )
date("d m y", 78299428934);