I have checked this question ([PHP/MySQL Display time since user's last login](https://stackoverflow.com/questions/11147746/php-mysql-display-time-since-users-last-login)) and it didn't helped me.

I have a user table in MySQL database. Here are the fields of user table.

```
uid
name
password
last_login (type = timestamp)

```

Whenever user login to website last\_login field get updated with current date time `(yyyy-mm-dd hh:mm:ss)`.

I am able to update last\_login field and it is working properly.

Now, I want to show difference between now and last\_login time. I tried SQL query to get the detail but it is not working. Here is the SQL query.

```
mysql_query("SELECT DATEDIFF(NOW(), last_login) FROM user where uid=1");

```

I tried to check this query in phpMyAdmin but it returns 0.

Please advise what I am doing wrong.