mysql怎么把字符串转成时间格式

lewis 2018-11-13 25次阅读

mysql把字符串转成时间格式的示例:

假如查询demo表的数据为:

+------------------+

|DueDate|

+------------------+

|11/02/201910:35|

|21/12/201812:01|

+------------------+

2rowsinset(0.00sec)

将表中字符串转成时间格式的语法:

selectdemo(DueDate,'%d/%m/%Y%h:%i%p')asConvertDatefromDemoTable;

得到结果:

+---------------------+

|ConvertDate|

+---------------------+

|2019-02-1110:35:00|

|2018-12-2100:01:00|

+---------------------+

2rowsinset(0.00sec)




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。