algorithmicCoder
algorithmicCoder

Reputation: 6799

MYSQL: How to select only users who signed up today

I know that I can check whether the linux timestamp in $time is today by doing this:

date("d-m-Y")==date("d-m-Y", $time);

But i want to use this in a select query to grab only users who signed up today like:

"SELECT * FROM user WHERE time = <TIMEISTODAY>";

time is an int in the user table that stores a linux time stamp.

I know i can filter the results AFTER selecting all users...but there's certainly a better way..i just don't know it..Thanks!

Upvotes: 0

Views: 274

Answers (1)

cypher
cypher

Reputation: 6992

SELECT * FROM user WHERE DATE(FROM_UNIXTIME(time)) = DATE(NOW())

Upvotes: 3

Related Questions