时间比较
时间 between 开始时间 and 结束时间
时间格式化
to_date(sysdate,'yyyy-mm-dd HH:mm:ss')
to_char(last_day(sysdate), ‘yyyy-mm-dd’)
获取时间
date
select sysdate from dual;
trunc函数
select trunc(sysdate, ‘mm’) from dual
select trunc(sysdate,‘yy’) from dual
select trunc(sysdate,‘dd’) from dual
select trunc(sysdate,‘yyyy’) from dual
select trunc(sysdate,‘d’) from dual
select trunc(sysdate) from dual
select trunc(sysdate, ‘hh’) from dual
select TRUNC(SYSDATE - 1) from dual
select add_months(trunc(sysdate),-1) from dual
select add_months(trunc(sysdate),1) from dual
char
select to_char(sysdate,‘yyyy-MM-dd HH:mm:ss’) from dual
select to_char(trunc(sysdate, ‘mi’),‘yyyy-MM-dd HH:mm:ss’) from dual
select to_char(last_day(sysdate), ‘yyyy-mm-dd’) from dual