josh42 Posted March 28, 2014 Share Posted March 28, 2014 Hi. I'm modifying the 'quotes' script in chapter 13 to include a statement before the quotes that indicates a 'new' or 'recent' quote if the quote was entered within the last 30 days. I know I need to use $row[date_entered] (type timestamp in mysql, e.g. 2014-03-09 13:25:11). Is there a function to compare that timestamp with today (in number of days)? Thanks. Link to comment Share on other sites More sharing options...
HartleySan Posted March 28, 2014 Share Posted March 28, 2014 I think this will answer your question: http://stackoverflow.com/questions/1095831/mysql-get-the-date-n-days-ago-as-a-timestamp 1 Link to comment Share on other sites More sharing options...
josh42 Posted March 29, 2014 Author Share Posted March 29, 2014 The example you listed uses mysql queries. Is there not a way to do this using PHP? Link to comment Share on other sites More sharing options...
HartleySan Posted March 29, 2014 Share Posted March 29, 2014 Sure there is. Here ya go: http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php 1 Link to comment Share on other sites More sharing options...
josh42 Posted March 30, 2014 Author Share Posted March 30, 2014 Thank you for the link. This is a helpful example. Link to comment Share on other sites More sharing options...
Recommended Posts