How can I get the difference between dates in hours in PHP & MySql? From the following query, I can get days but not hours. mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30'); How can I get exact hours also. I want to display like "2 hours ago" or "3 hours ago"? Thanks in advance.
MySQL has both DATE and TIME functions. Have you tried TIMEDIFF? http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html