Nel L
Nel L

Reputation: 145

Amazon Redshift return name of day

I am trying to get the name of the day of a specific date. For example for the date "11/22/2019" I want the result to be "Friday"

I use Amazon Redshift.

Any ideas?

Thanks

Upvotes: 8

Views: 12916

Answers (2)

Jyothi
Jyothi

Reputation: 11

To avoid empty space in the output of 'select to_char(current_date, 'Day');' and to get the exact day name you can use the below query.

select trim(' ' FROM to_char(current_date, 'Day'));

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1271111

You can use to_char():

select to_char(datecol, 'Day')

Note that this value is padded to 9 characters, so for most weekdays, it will end in a bunch of spaces.

Upvotes: 10

Related Questions