MySQL Select if Timestamp is in the past

datetime, mysql, php

Solution

SELECT `Name` FROM `TABLE` WHERE `timestamp` < NOW();

Should get you what you want.

Problem

I have a database like this: ``` TABLE Name | timestamp ------------------------------------------ Hello | 2013-02-23 14:26:18 Yo | 2013-03-22 14:26:18 ``` I want to do a SQL Select where only things that are in the past (e.g. the timestamp isn't set for the future) are selected. What would be the best way to do that? Thanks for any help. EDIT: I tried the suggestions but none of them seem to work, here is the query: ``` SELECT * FROM TABLE WHERE timestamp<NOW() ``` And it still selected everything, I also tried: ``` SELECT * FROM TABLE WHERE timestamp<CURRENT_TIMESTAMP ``` And it still selected everything again. It's really wierd, when I use "timestamp>CURRENT_TIMESTAMP" it seems to work (it hides all items not from the future) but not when I try the other direction which makes no sense. Could it be a timezone issue or something like that?

Original source