UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)
如果不带参数调用,返回一个Unix时间戳(自“1970-01-0100:00:00”UTC)作为无符号整数。如果UNIX_TIMESTAMP()被调用有一个日期参数,它返回的参数为秒,自“1970-01-0100:00:00”UTC的数值。日期可能是一个DATE字符串,一个DATETIME字符串,一个TIMESTAMP或数字格式YYYYMMDD或YYYYMMDD。
mysql> SELECT UNIX_TIMESTAMP(); +---------------------------------------------------------+ | UNIX_TIMESTAMP() | +---------------------------------------------------------+ | 882226357 | +---------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00'); +---------------------------------------------------------+ | UNIX_TIMESTAMP('1997-10-04 22:23:00') | +---------------------------------------------------------+ | 875996580 | +---------------------------------------------------------+ 1 row in set (0.00 sec)