针对此日期格式的各种转换:'2022-01-31 15:06:23'

https://blog.csdn.net/weixin_42342968/article/details/124752485

1、转换为日期格式
select DATE_FORMAT('2022-01-31 15:06:23','yyyy-MM-dd');
select to_date('2022-01-31 15:06:23');


2、转换为年
select year('2022-01-31 15:06:23');

 

3、转换为月
select month('2022-01-31 15:06:23');

 

4、转换为天
select day('2022-01-31 15:06:23');

 

5、转换为小时
select hour('2022-01-31 15:06:23');

 

6、转换为分钟
select minute('2022-01-31 15:06:23');

 

7、转换为秒
select second('2022-01-31 15:06:23');

 

posted @ 2023-02-17 17:44  yinghualeihenmei  阅读(40)  评论(0编辑  收藏  举报