select to_char(sysdate,'yyyyMM') from dual; select to_char(to_date('202210','yyyyMM'),'yyyyMM') from dual;
--计算月份差值返回整数 select months_between(to_date('2023-01','yyyy-MM'),to_date('2022-12','yyyy-MM')) from dual select months_between(to_date('2023-1','yyyy-MM'),to_date('2022-03','yyyy-MM')) from dual
--计算差值返回小数 select months_between(to_date('2023-1-13','yyyy-MM-dd'),to_date('2022-03-29','yyyy-MM-dd')) from dual
标签:yyyyMM,函数,MM,yyyy,date,日期,dual,oracle,select From: https://www.cnblogs.com/q202105271618/p/16972441.html