简体   繁体   中英

sql date in mmddyy format in DB2

I have this simple query that is driving me crazy.

select current_date as "TODAY" from table

except that I need the date to be in mmddyy format. so If I run it today it would be 030918.

I am using DB2

If you want the date in a particular format, then convert it to a string, using to_char() :

select to_char(current_date, 'MMDDYY') as "TODAY"
from table;

选择替换(convert(varchar(10),GETDATE(),1),'/','')

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