Navid .
Navid .

Reputation: 107

MysQL Get Time via Query

The time in row 'Signup' is stored like this: "1427538785" So I am not able to use this method: WHERE DATE(Signup) = DATE(NOW())

But need to get the query where time of signup is today..

Any Idea how to solve this?

Upvotes: 1

Views: 45

Answers (2)

Abhik Chakraborty
Abhik Chakraborty

Reputation: 44874

You need from_unixtime

mysql> select from_unixtime('1427538785','%Y-%m-%d');
+----------------------------------------+
| from_unixtime('1427538785','%Y-%m-%d') |
+----------------------------------------+
| 2015-03-28                             |
+----------------------------------------+
1 row in set (0.00 sec)

So the query will be

WHERE from_unixtime(Signup,'%Y-%m-%d') = curdate();

Upvotes: 1

juergen d
juergen d

Reputation: 204894

WHERE DATE(FROM_UNIXTIME(Signup)) = curdate()

Upvotes: 0

Related Questions