mysql从字符串中获取时间的案例:
addtime='2020-11-17 15:47:50'substr(addtime,1,10) as 创建日期
SUBSTR(string, string charcter, number of charcters)
参数含义:
string:为字符列或字符串表达式
string charcter:子串的起始位置
number of charcters:返回字符的个数
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>
推荐阅读:sql如何从字符串中获取子字符串