I’m trying to write a script that will display entries in a MySQL database only up to a certain date, specifically a week from the current date. In the database, I have a datetime column that registers every time a new entry is made. I would only like the printout to display the entries that are a week or less old.
I can’t figure out how to do this, I’ve tried various MySQL queries to only get the ones that are a week old, but can’t seem to get it right.
A second question I have is that each entry will be displayed with the date it was put in, and I would like it to display in a more readable fashion than Y-m-d H:m:s, but can’t seem to figure this out either. I’ve tried fooling around with the date() function, but can only get this to work with the current date and time, and not the one from the database.
Any help on either of these is much appreciated.