TIMESTAMPDIFF(SECOND,
now(),
'2011-01-27
15:52:11')语法为:TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2),其中unit单位有如下几种,分别是:FRAC_SECOND
(microseconds),
SECOND,
MINUTE,
HOUR,
DAY,
WEEK,
MONTH,
QUARTER,
or
YEAR.
用时间戳来计算
SELECT (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP('2015-04-20 15:12:12'))/60也就是得到两个时间相差的秒数,然后除60得到分种。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)