I have a datatable that saves created data as : user.createddate
Every time I add to the datatable, it saves as such for this data(timestamp) :
2016-02-02 09:10:26
What would be the best way for me to parse the timestamp, and only display results that are "x" old?
I added the following per suggestion, but it still does not parse correctly :
$cond = 'WHERE user.createddate >= DATEADD(day,-7, GETDATE())';
@Eugen helped me out in the comments. Basically, user.createddate has the entire datetime that needs to be seperated first to give me an approximation to work with in days previous, using the following code you can do as such :
$sql = "SELECT
*
FROM
".$table."
WHERE
DATE(edit_date) = DATE_SUB(CURDATE(), INTERVAL 7 DAY)
";
return $sql;
I will mark you as best answer, if you post as actual answer. Thanks!