By using the
to_char() function with a date or timestamp,
we can determine the day of the week by name (e.g. Monday).
For instance, to determine what day today is,
try a statement like the following:
> select to_char(now(), 'Day'); to_char ----------- Sunday
Day part of the second argument is just one of many template patterns
that can be used for formatting dates and times.
See Data Type Formatting Functions in the Postgres docs for more details.