MM-DD-RRRR / MM-DD-YYYY 的區別 (Date format)
先各位執行一下下面SQL. 結果會如何呢?
select to_date('05/01/02','YYYY-MM-DD') YYYY ,to_date ('05/01/02','RRRR-MM-DD') RRRR
from dual
結果如下:
-------------------------------------------------
YYYY RRRR
0005-01-02 00:00:00 2005-01-02 00:00:00
-------------------------------------------------
什麼原因 ?
RR
Yes Lets you store 20th century dates in the 21st century using only two digits.
See Also: Additional discussion on RR datetime format element in the Oracle Database SQL Reference
RRRR
Yes Round year. Accepts either 4-digit or 2-digit input. If 2-digit, provides the same return as RR. If you do not want this functionality, then enter the 4-digit year.
Yes Lets you store 20th century dates in the 21st century using only two digits.
See Also: Additional discussion on RR datetime format element in the Oracle Database SQL Reference
RRRR
Yes Round year. Accepts either 4-digit or 2-digit input. If 2-digit, provides the same return as RR. If you do not want this functionality, then enter the 4-digit year.
RRRR : 這邊說得如果你輸入的是2位數字 則會轉換為 四位年,如果是四位年,則保持不變。
而 YYYY 只是將同一位置上的字元轉換為要求的字元,如果為數不夠則用0 補充。
這就是RRRR /YYYY 的區別!
By -myhuaer
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/34596/viewspace-804490/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MM-DD-RRRR / MM-DD-YYYY 的區別【Blog 搬家】
- Mysql date_format 與 Oracle to_char(date,’format’)MySqlORMOracle
- date_format(date,frm) 詳解ORM
- Mysql的DATE_FORMAT()應用MySqlORM
- mysql DATE_FORMAT函式MySqlORM函式
- date類與calendar的區別
- Unexpected Date format in BroadcastingORMAST
- vard=Date()與vard=newDate的區別
- Linux和DOS的FORMAT命令區別(轉)LinuxORM
- 時間格式nls_date_format的設定ORM
- HGDB相容MySQL date_format函式MySqlORM函式
- Oracle中Date和Timestamp的區別Oracle
- java:Date和DateTime區別Java
- 修改資料庫的NLS_DATE_FORMAT引數資料庫ORM
- Oracle的NLS_DATE_FORMAT設定(日期格式設定)OracleORM
- java.util.Date和java.sql.Date有什麼區別?JavaSQL
- (轉)修改oracle預設日期格式 nls_date_formatOracleORM
- oracle中sysdate和current_date兩者的區別Oracle
- [20170918]NLS_DATE_FORMAT設定.txtORM
- date型別型別
- mysql資料庫date 、datetime、time、timestamp區別MySql資料庫
- spring.jackson.date-format失效原因及解決方案SpringORM
- 如何啟動資料庫後不設定NLS_DATE_FORMAT資料庫ORM
- rman會話中設定nls_date_format和nls_lang會話ORM
- 面試題:能談談Date、Datetime、Time、Timestamp、year的區別嗎?面試題
- date型別的內部結構型別
- DATE型別擷取到天的效率型別
- Date型別和Regex型別型別
- oracle timestamp轉換date及date型別相減Oracle型別
- DATE型別INTERVAL分割槽型別
- oracle 中關於當前的sysdate,sysstimestap,current_date,curent_timestamp 區別Oracle
- date、timestamp欄位型別型別
- ibatis查詢date型別BAT型別
- Oracle中date型別使用注意Oracle型別
- SQL Server日期資料型別DATE的使用SQLServer資料型別
- 字串和Date型別之間的轉換字串型別
- mongoose的date型別和timestamps的使用Go型別
- 將timestamp型別轉換為date型別型別