trunc()在操作日期时,相当于把时间格式化为零时零分零秒
select sysdate,trunc(sysdate) from dual;
通过执行以上脚本可以发现,被trunc处理过的只有日期,没有时间
trunc传参的用法:
select trunc(sysdate-1) from dual t;–昨天
select trunc(sysdate+1) from dual t;–明天
select trunc(sysdate, ‘yy’) from dual;–当年第一天
select trunc(sysdate, ‘year’) from dual;–当年第一天
select trunc(sysdate, ‘yyyy’) from dual;–当年第一天