MySQL unix_timestamp()函數
UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)
如果調用不帶參數,返回一個UNIX時間戳(自“1970-01-0100:00:00”UTC)的一個無符號整數。如果UNIX_TIMESTAMP()被調用帶有日期參數,它返回的參數為秒,自“1970-01-0100:00:00”UTC的值。日期可能是日期字符串,時間字符串,一個TIMESTAMP或數字格式YYMMDD或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)