Log in

View Full Version : Recent date() entry



crobinson42
06-01-2010, 06:56 PM
Does anyone know why this code isn't working today?!




$four_days_ago = strftime("d-M-y", strtotime("-4 days"));

$query2 = "SELECT * FROM bobo WHERE date_time >= '$four_days_ago' ORDER BY id";

I have a bulletin board, and on the front page it shows the recent post's for the last 4 days.. if i set the date of a database entry to 30MAY10 it works just fine.. but if it get's set to 01JUN10 it doesn't show up..

Any help/thought is appreciated!

Cory

bluewalrus
06-01-2010, 07:15 PM
I assume it'd be the operation.
30-4 = 26
1-4 = -3

traq
06-01-2010, 07:57 PM
use the timestamp for comparison, instead of the formatted "d-M-y".