格式化到 年月日
# 将时间换成列名就行;当前是秒级时间戳,如果是毫秒的 / 1000即可 # select from_unixtime(1602668106666.777888999 / 1000,'%y-%m-%d') as a; # select from_unixtime(列名 / 1000,'%y-%m-%d') as a; select from_unixtime(1602668106.666777888999,'%y-%m-%d') as a;
格式化到 年月日 时分秒
# 将时间换成列名就行;当前是秒级时间戳,如果是毫秒的 / 1000即可 select from_unixtime(1602668106.666777888999,'%y-%m-%d %h:%i:%s') as a;
格式化到毫秒:
select from_unixtime(1602668106.666777888999,'%y-%m-%d %h:%i:%s.%f') as a; # 或 select left(from_unixtime(1602668106.666777888999,'%y-%m-%d %h:%i:%s.%f'),23) as a;
到此这篇关于mysql时间戳格式化yyyy-mm-dd的使用的文章就介绍到这了,更多相关mysql时间戳格式化yyyy-mm-dd内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!
发表评论