Reputation: 383
I have a mysql db with a particular field, update_date, that has a unix timestamp format in. Some records have update_date in the future, some in the past.
I want to select all records that appear in the past only.
I was trying this:
SELECT * FROM news WHERE update_date < NOW()
which doesn't work as NOW isn't using unix time so I'm trying to figure out how to make use of the UNIX_TIMESTAMP function that I've seen for mysql?
Upvotes: 1
Views: 37
Reputation: 172458
Try this:
SELECT * FROM news WHERE update_date < UNIX_TIMESTAMP()
You can also refer UNIX_TIMESTAMP()
Here is a demo to show the Unix_Timestamp getting current date in unix timestamp format.
Upvotes: 3