SECOND(time) 函数用来返回指定时间的秒数,范围为 0 到 59。
time 时间
(1)返回指定时间的秒数,如下:
mysql> SELECT SECOND('10:05:03'); +--------------------+ | SECOND('10:05:03') | +--------------------+ | 3 | +--------------------+ 1 row in set
(2)返回当前时间的秒数,如下:
mysql> SELECT SECOND(NOW()); +---------------+ | SECOND(NOW()) | +---------------+ | 57 | +---------------+ 1 row in set
(2)返回当前时间的秒数,如下:
mysql> SELECT SECOND(CURRENT_TIME()); +------------------------+ | SECOND(CURRENT_TIME()) | +------------------------+ | 23 | +------------------------+ 1 row in set