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 -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -