oracle常用时间转换
计算年龄
SELECT TRUNC(months_between(sysdate, birth)/12) AS age from T_JBXX_XXXX;
转化日期格式为YYYY年MM月DD日
SELECT to_char(to_date('2017-05-23','YYYY-MM-DD'),'YYYY"年"MM"月"DD"日"') FROM DUAL;
转化时间带小数点 YYYY.MM.DD
SELECT to_char(to_date('2017-05-23','YYYY-MM-DD'),'YYYY"."MM"."DD') FROM DUAL;
英文简写月份
select TO_CHAR(sysdate,'Mon','nls_date_language = ''American''') from dual;
加某几个月
SELECT TO_CHAR(ADD_MONTHS(TO_DATE('2021-01-01','yyyy-MM-dd'),12),'yyyy-MM-dd') FROM DUAL;