Sanchay
Sanchay

Reputation: 1103

convert Date to DD-MMM-YY in redshift

I have a requirement to convert the yyyy-MM-dd date format into DD-MMM-YY.

e.g.: 2018-06-14 -> 14-JUN-18.

I tried to_char(date,'DD-MMM-YY'), however it's resulting in 14-06M-18.

Is this possible?

Upvotes: 0

Views: 5268

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520988

The format mask for the three letter month abbreviation in all caps is MON, not MMM:

to_char(date, 'DD-MON-YY')

Maybe you are coming from another API/language where MMM would have worked in that case.

Upvotes: 3

Related Questions