php - select posts from the last month -
this question has answer here:
- mysql: query rows previous month 9 answers
in table posts have column named date format - datetime - current timestamp , need select posts last month only.
all dates in column december 2016. example - 2016-12-09 04:25:00
<?php $start = strtotime("-1 month"); // 1488285716 $stmt = $db->query("select * posts date > " . $start . " order by..."); ?> but posts selected! resulut should zero.
help?
use this
$start = strtotime("-1 month"); $date = date('y-m-d h:i:s', $start); $stmt = $db->query("select * posts date > " . $date . " order by...");
Comments
Post a Comment