Re: use of datediff and/or timediff
Hi,
I presume 'lastlogin' is a date-time field in you 'members' table...
like '2004-08-27 11:24:22'
Then You can use UNIX_TIMESTAMP() to convert that date into UNIX Timestamp and then proceed with finding difference..
mysql> select count( memberid )
from members
where
FLOOR((UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(lastlogin))/60)<15 ;
I divide the result in seconds by 60 to get minutes and floor to get
INTEGER VALUE (say 3 for 3.2) ;
Hope this helps ...
Regards,
Ram.
Refer :
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
We Learn the Most When we have to Invent
Subject
Written By
Posted
Re: use of datediff and/or timediff
August 27, 2004 12:55AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.