This query displays count Actions grouped by day of the week.
select count(*) c,
date_part('dow', "updatedAt" at time zone 'Europe/Paris') dow
from "Action" date_part('dow', "updatedAt" at time zone 'Europe/Paris')
Days are displayed as number. Is there a way to display it as text? Does PostgreSQL has such a function?
2
Answers
IF you want text format use
::TEXT
at the end. in future you can use other like::DATE
,::TIMESTAMP
,::DECIMAL
…date_part('dow', "updatedAt" at time zone 'Europe/Paris')::TEXT dow
Use to_char() to format a date or timestamp value as text. You can use
Day
to display the day’s name (e.g. Tuesday)