一、查看当前时间
now函数
mysql> select now(); +---------------------+ | now() | +---------------------+ | 2016-04-29 22:04:42 | +---------------------+ 1 row in set (0.00 sec)
二、通过unix时间获取字符串格式的时间
FROM_UNIXTIME函数
mysql> select FROM_UNIXTIME(1461938772); +---------------------------+ | FROM_UNIXTIME(1461938772) | +---------------------------+ | 2016-04-29 22:06:12 | +---------------------------+ 1 row in set (0.17 sec)
应用:
select FROM_UNIXTIME(clock) as date, userid, action, ip, resourcename from auditlog where clock> %s;" % yest_clock
注意:linux中获取当前unix时间 date +%s
三、
时间: 2024-10-24 07:33:02