针对此日期格式的各种转换:'2022-01-31 15:06:23'
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');