MYSQL中的timemediff
我正在使用Interchange IC (http://interchange.rtfm.info/icdocs/index.html)
[query list=1 sql="SELECT TIMEDIFF(NOW(),'[sql-param time]') as diff"]
my $vardifftime = [sql-param diff];
$vardifftime
输出为空白
我想没有当前时间和datetime类型列在mysql数据库之间的小时。[sql-param time]存储日期时间
SELECT ROUND((UNIX_TIMESTAMP()-UNIX_TIMESTAMP('[sql-param time]'))/3600);
是[sql-param time]
是datetime
的,因为timediff
期望两个表达式是同一类型。如果[sql-param time]是time only,那么你可以这样做
SELECT TIMEDIFF(TIME(NOW()),'[sql-param time]') as diff