简体   繁体   中英

Oracle SQL Date Format

I have been trying to convert the following varchar into date format with no luck:

12/99
01/04 

I have tried to_char(mydate, 'mm/yy') which gives me errors. Is there any way to convert this to date format even though I am missing the day?

You can use RR format for year:

select to_date('12/99','mm/rr') from dual --01/12/1999
select to_date('01/04','mm/rr') from dual --01/01/2004

This format get years between 1950 to 2049.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM