I am trying to extract the time of day from the "timestamp" column in PostgreSQL. This is how I did it, but ... it's terrible. Idea how to do it better?
SELECT (
date_part('hour', date_demande)::text || ' hours ' ||
date_part('minute', date_demande)::text || ' minutes ' ||
date_part('second', date_demande)::text || ' seconds'
)::interval AS time_of_day
FROM table;
source
share