select to_date('20190701 12:23:46','yyyymmdd hh24:mi:ss') from dual;
輸出:2019/7/1 12:23:46code
select to_date('2019-07-01 12:23:46','yyyy/mm/dd hh24:mi:ss') from dual;
輸出2019/7/1 12:23:46字符串
select sysdate from dual;
輸出:2019/7/5 16:24:40
時間爲null的用法date
select to_date(null) from dual;
輸出:[null]select
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
輸出:2019-07-05 16:25:27時間
select to_char(sysdate,'yyyy"年"mm"月"dd"日" hh24"時"mi"分"ss"秒"') from dual;
輸出:2019年07月05日 16時35分36秒co
select to_char(sysdate,'fmyyyy-mm-dd fmhh24:mi:ss') from dual;
輸出:2019-7-5 16:37:09字符
select to_char(sysdate,'yyyy') from dual;
輸出:2019日期
select to_char(sysdate,'yy') from dual;
輸出:19
select to_char(sysdate,'mm') from dual;
輸出:07
select to_char(sysdate,'month') from dual;
輸出:7月
select to_char(sysdate,'dd') from dual;
輸出:05
select to_char(sysdate,'ddth') from dual;
輸出:05th
select to_char(sysdate,'day') from dual;
輸出:星期五
select to_char(sysdate,'day','NLS_DATE_LANGUAGE = English') from dual;
輸出:Friday
select to_char(sysdate,'hh24'),to_char(sysdate,'hh'),to_char(sysdate,'mi'),to_char(sysdate,'dd') from dual;
輸出:16 04 40 05