Extracting day of the week from a timestamp

Hi,

I’m attempting to extract ‘Friday’ from a timestamp field that appears this way when viewing the data formatted as a timestamp: 2020-01-10 21:26:41.0

I’ve tried so many different options but am unable to get the timestamp to convert to the DAY format.

This attempt just gave me the day of the month, but I need to get day of the week:
select DATE_PART(‘day’,cast(substring(cast(date_field as varchar),1,10) as date)) from tablename

This gave me day of month as well:
select extract(DAY from date_field) from tablename

Thanks!

You can use TO_CHAR here to covert a date/time to a string value. So in this case TO_CHAR(col1, 'DAY') will work.

1 Like

that worked! Thank youuuu!