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

1158
2021/2/2 17:04:59
栏目: 云计算
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

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

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

假如查询demo表的数据为:

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

| DueDate     |

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

| 11/02/2019 10:35 |

| 21/12/2018 12:01 |

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

2 rows in set (0.00 sec)

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

select demo(DueDate,'%d/%m/%Y %h:%i %p') as ConvertDate from DemoTable;

得到结果:

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

| ConvertDate    |

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

| 2019-02-11 10:35:00 |

| 2018-12-21 00:01:00 |

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

2 rows in set (0.00 sec)


辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: python输出字符串用什么函数