Reputation: 145
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
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
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