I'm trying to get the results of the past 15 days in a database. The time is added in epoch format, like 1400904415
.
I'm trying to get only the last results (15 days), so I'm wondering if it is possible to do something like this:
SELECT * FROM dataadded WHERE createdate="here something like createdate its bigger than currentdate - 15 days"
Is that possible?
SELECT * FROM dataadded WHERE createdate >= DATE_SUB(CURDATE(), INTERVAL 15 DAY);
You can also do this in PHP if you don't want to offload the work to your database
$date = time() - (86400 * 15); //86400 seconds = 1 day
$sql = 'SELECT * FROM dataadded WHERE createdate=' . $date;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.