oracle中 trunc 處理日期的用法

2022-09-01 02:54:12 字數 1469 閱讀 5324

1select trunc(sysdate) from dual  結果是 截止到當日

不設定,預設是截止到」日「

--獲取到本年 第一天

--獲取到 本月 第一天 

--獲取到本季度 第一天

--預設獲取到日(當日的零點零分零秒)

--本周一

-- 獲取離當前時間最近的周四,若當天為周四則返回當天,否則返回上周四

--獲取到周(本週第一天,即上週日)

--擷取到小時(當前小時,零分零秒)

--擷取到分(當前分,零秒)

Oracle中的trunc()函式

oracle中的trunc 函式是對時間型別或者數字進行擷取操作的。1 trunc date 的用法一般有以下幾種 select sysdate from dual select to char sysdate,yyyy mm dd hh mi ss from dual?select trunc s...

Oracle中trunc()函式用法

sql表示式 注釋select sysdate from dual 當前系統時間,24小時制 select to char sysdate,yyyy mm dd hh24 mi ss from dual 當前系統時間,24小時制 select to char sysdate,yyyy mm dd h...

oracle中的trunc 函式

oracle中的trunc 函式是對時間型別或者數字進行擷取操作的。一般用法為trunc date,fmt 其中fmt 是我們要展示的時間字段,或者trunc number 該函式表示取整。trunc date 的用法一般有以下幾種 trunc sysdate,yyyy 返回當前年的第一天 trun...