psychowolvesbane Posted April 28, 2008 Share Posted April 28, 2008 Okay I want to know how I can use the date function to query against records in a table, and to show only records that are 2 weeks old compared to todays date. So the table record is set to date(Y-m-d), so how do I go about comparing it with the current date and finding any records older than 14 days old? I don't need to worry about the sql, just get it so there is a variable to compare against. Link to comment https://forums.phpfreaks.com/topic/103209-solved-date-function-help/ Share on other sites More sharing options...
p2grace Posted April 28, 2008 Share Posted April 28, 2008 The easiest way is to use the query to do it. $query = "SELECT * FROM `table` WHERE `date_field` >= DATE_SUB(NOW(), INTERVAL 14 DAY)"; Link to comment https://forums.phpfreaks.com/topic/103209-solved-date-function-help/#findComment-528684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.