把当前时间转换成 unix 时间戳:
select unix_timestamp();
输出结果:
取正确的当前时间,用current_timestamp 函数:
select current_timestamp();
输出结果:
将当前时间按照指定格式进行格式化:
select date_format(current_timestamp,'yyyy-MM-dd HH:mm:ss');
输出结果:
from_unixtime用来将一个unix时间戳转换成我们需要的格式:
select from_unixtime(unix_timestamp(