'Snowflake: Converting a date + timestamp to timestamp + day of the week

Right now, I have a column which is in date + timestamp format. Like so: 2022-02-24 17:30:00.000

Does anyone know how to convert this into something like Thursday 17:30:00.000

I don't want to convert anything to a string and concat that way, as then it'll be difficult to graph in snowsight.



Solution 1:[1]

Snowflake has a 3 Letter Day, but does not appear to have full name days, for free in the TO_CHAR formatting.

SELECT '2022-02-24 17:30:00.000'::timestamp as my_timestamp,
    TO_CHAR(my_timestamp, 'DY HH:MM:SS.FF');
MY_TIMESTAMP TO_CHAR(MY_TIMESTAMP, 'DY HH:MM:SS.FF')
2022-02-24 17:30:00.000 Thu 17:02:00.000000000

but that is not the long form you requested.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simeon Pilgrim