Day Of Week By Name For A Date
In Day Of Week For A Date, I explained how to
determine what day of the week a date is as an integer with PostgreSQL. This
date_part() function. 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
> 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.Tweet