php - select posts from the last month -


this question has answer here:

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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

asp.net ajax - Jquery scroll to element just goes to top of page -