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

主机教程 建站分享 1年前 (2022-12-09) 145次浏览

文章摘要:mysql怎么把字符串转成时间格式 mysql中将字符串转换成时间格式

mysql把字符串转成时间格式的示例: 假如查询demo表的数据为: +------------------+ […]

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)


声明:
若非注明,本站文章源于互联网收集整理和网友分享发布,如有侵权,请联系站长处理。
文章名称:mysql怎么把字符串转成时间格式 mysql中将字符串转换成时间格式
文章链接:https://www.7966.org/post/15092.html
转载请注明出处

喜欢 (0)